This is an in-progress list of resources to support my talk about JSON:API at Laracon Online 2020.

My slides!

Instructions on implementing JSON:API

What you get from each option

Eloquent Resources + Spatie Query Builder Fractal + Spatie Query Builder Laravel-JSON-API
Basic data structure x x x
Pagination x x x
Filters x x x
Easy includes & nested includes x x x
Sparse fieldsets x x x
Easy sorts x x x
Easy flat include syntax x x
Errors x
Content negotiation x
Route auto-binding and -mapping x
Easy relationship routes & links generation x
Audit requests for JSON:API compliance x
Create/update validation framework x
Testing helpers x

Links

Big required pieces of JSON:API APIs

  • Content Negotiation & appropriate status codes
  • Top level data/errors/meta
  • Resource Identifier Objects: string "id" and string "type"
  • Other properties stored in "attributes" object on resource
  • If showing relationships, stored in "relationships" object on resource
  • If storing meta, stored in "meta" object with key/value pairs
  • (optional) "links" object with related URLs
  • (optional) Compound documents' resources in flat "included" array
  • Specific error format
  • Specific resource naming format (a-zA-Z_-)
  • Specifications around requesting mutations (full CRUD specified)

Goals

  • Clean all of these pages up into full tutorials
  • Show a real proof of flat includes with Eloquent Resources
  • Find simple solutions for the items that Eloquent Resources and Fractal don't have, if anyone would prefer not using Laravel-JSON-API

Subscribe

Quick links to fresh content, and more thoughts that don't make it to the blog