!!! Project abandoned. See cloudcreativity/laravel-json-api for a great alternative.
Make it a breeze to create a jsonapi.org compliant API with Laravel 5.
This library strives to be up to date with the latest JSON API updates—as the spec is still a work in progress. If you notice that something is missing, please contribute!
-
Add
echo-it/laravel-jsonapi
to your composer.json dependency list (version 2.0.0 at the minimum for laravel 5 support) -
Run
composer update
.
- PHP 5.4+
- Laravel 5
This library is made with the concept of exposing models in mind, as found in the RESTful API approach.
In few steps you can expose your models:
-
Create a route to direct the requests
In this example, we use a generic route for all models and HTTP methods:
Route::any('{model}/{id?}', 'ApiController@handleRequest');
-
Create your controller to handle the request
Your controller is responsible to handling input, instantiating a handler class and returning the response.