This is a small Laravel project to test your PHP skills. It exposes a simple API endpoint that returns a list of vehicle families from which you are to transform and then save into a CSV file.
- Clone this repository
- Run
composer install
- Run
php artisan serve
- Visit
http://localhost:8000/api/vehicles/families
in your browser to ensure the API is working
- Create a new Laravel command that will transform the API response into a CSV file (
php artisan make:command ExportVehicles
) - Using a HTTP client of your choice, make a request to the API endpoint (
http://localhost:8000/api/vehicles/families
) - Transform the response into an array of vehicle family objects of the following structure:
[ [ 'id' => 1, 'type' => 'REDBOOK', 'make' => 'Ford', 'label' => 'Focus' 'slug' => 'focus', 'value' => 'dadd330c5584660c' ], ... ]
- Sort the transformed array by the
label
key in ascending order - Save the transformed data into a CSV file in the
storage/app
directory