Category: Laravel, api

Published: Jun 28, 2020 by C.S. Rhymes I was using Laravel to retrieve and display data from a Moodle installation and started using the HTTP Client in Laravel 7 and wondered if I could convert the retrieved data from an array into a more predictable object.

Now we have an array of users, we can look at how we can add some types to it.

We need to look at each property and then define what type of data it is.

Hopefully you can see the benefits Laravel Http Client and Spatie Data Transfer Object can bring to your application.

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Community Partners