{"repo":"timacdonald/json-api","free":true,"listed":false,"github":"https://github.com/timacdonald/json-api","clone":"git clone https://github.com/timacdonald/json-api.git","description":"A lightweight API resource for Laravel that helps you adhere to the JSON:API standard. Supports sparse fieldsets, compound documents, and more.","language":"PHP","stars":642,"topics":["laravel","json-api","php"],"license":null,"category":"api-integrations-sdks","readme_excerpt":"JSON:API Resource for Laravel A lightweight API resource for Laravel that helps you adhere to the JSON:API standard with support for sparse fieldsets, compound documents, and more baked in. Note These docs are not designed to introduce you to the JSON:API specification and the associated concepts, instead you should head over and read the specification if you are not yet familiar with it. The documentation that follows only covers how to implement the specification via the package. Table of contents - Installation - Getting started - Creating your first JSON:API resource - Adding attributes - Adding relationships - A note on eager loading - Digging deeper - Attributes - toAttributes() - Sparse fieldsets - Minimal attributes - Lazy attribute evaluation - Relationships - toRelationships() - Customising the relationship resource class guessing Installation You can install using composer from Packagist. Getting started The JsonApiResource class provided by this package is a specialisation of Laravel's Eloquent API resource. All public facing APIs are still accessible; in a controller, for example, you interact with a JsonApiResource as you would with Laravel's JsonResource class. As we make our way through the examples you will see that new APIs are introduced when interacting with the class internally , for example, the toArray() method is no longer used. Creating your first JSON:API resource To get started, let's create a UserResource for our User model. In our user resource wi","default_branch":null,"files":null,"tree":[],"storefront":"/r/timacdonald","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/timacdonald/json-api/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}