Interact with API result values as object properties in Laravel

With the object method in the Laravel HTTP client, you can easily interact with API result values as object properties.

1// https://api.adviceslip.com/advice response
2// {
3// "slip": {
4// "id": 100,
5// "advice": "Everybody makes mistakes."
6// }
7// }
8 
9$advice = Http::get('https://api.adviceslip.com/advice')->object();
10 
11$advice->slip->id; // 100
12$advice->slip->advice; // Everybody makes mistakes.