The largest feature to come to Laravel 5.5 is the API resources. This feature allows you to manage your JSON payloads for your API much easier. For those of you maintaining APIs in Laravel, you will begin to jump for joy with how easy this has become.

Think of API resources like templates for your JSON payloads. In the past, previous versions of Laravel would run a simple json_encode on your model objects to return a JSON request. This meant you were outputing a direct mapping of your database (minus any hidden fields you defined). This is bare bones functionality and generally is ok for internal APIs but much more control is required for Public APIs.

Thanks to API resources we now have an easy way to control the layout of our JSON payloads by creating a “resource” and defining the structure in the resource. I like to think of resources as “JSON templates”. With these templates we can define the information we want in the resource and even create or combine information from multiple models or nested relationships.

The video explains all of this in more detail than I can explain here, so be sure to check it out.

==== LINKS ====

Documentation on API Resources


Full Playlist for the “Laravel 5.5 New Features“ Series:

==== FOLLOW ME ====

Subscribe for New Releases!

Subscribe to DevMarketer Insider
[Email Newsletter]

Twitter –
(ask me questions!)

==== QUESTIONS? ====

Leave a comment below and I or someone else can help you.
For quick questions you may also want to ask me on Twitter, I respond almost immediately.

Read also >>  Dashmix - Bootstrap 4 Admin Dashboard Template & Laravel 6 Starter Kit

Email me

Thanks for all your support!



Please enter your comment!
Please enter your name here