! (https://travis-ci.org/pkracer/json-api-documents.svg)
This package can be used to format api responses to adhere to the Json Api specification v1.0
Via Composer
$ composer require pkracer/json-api-documents
The following versions of PHP are required by this version.
- PHP 5.5
- PHP 5.6
- PHP 7.0-dev
- HHVM
$document = new \Pkracer\JsonApiDocuments\Document();
$document->describe(['version' => '1.0'])
->meta(['count' => '10'])
->links([
'self' => 'http://example.com/articles',
'next' => 'http://example.com/articles?page[offset]=2',
'last' => 'http://example.com/articles?page[offset]=10'
]);
$document = new \Pkracer\JsonApiDocuments\Document();
$document->describe(['version' => '1.0'])
$posts = \App\Post::all();
$document->data($posts);
The MIT License (MIT). Please see License File for more information.