v3.0.0is out

Laravel JSON:API

JSON:API 1.1 resources for Laravel, with typed values, validated includes and fieldsets, and API revisions.

PostResource.php
#[JsonApiType('posts')]
final class PostResource extends JsonApiResource
{
    public function toAttributes(Request $request): iterable
    {
        return [
            'title' => $this->string(),
            'published-at' => $this->datetime('published_at'),
        ];
    }
}
GET /posts/10
{
  "jsonapi": { "version": "1.1" },
  "data": {
    "type": "posts",
    "id": "10",
    "attributes": {
      "title": "JSON:API",
      "published-at": "2026-01-02T03:04:05+00:00"
    }
  }
}

Why Laravel JSON:API

A hand-built JSON:API document repeats its types, ids and linkage, loads relations one query at a time, and lets an unknown include pass silently. Describe each resource once: the package renders the document the request asks for, loads it in batch and validates the query.

Includes and sparse fieldsets

One query per relation and per include level, and only the fields the client asks for are computed.

Relationships

To-one, to-many and polymorphic, guessed from the model, with their links, meta and linkage.

Conditions

Members rendered when loaded, when present, when asked in fields, or on any closure.

API revisions

Each client stays on a dated revision of your API; your code keeps only the latest shape.

Compatibility

PHP 8.3 and Laravel 12.46 or later.

VersionPHP Laravel Status
3.x^8.3^12.46 || ^13.0Active
2.x^8.3^12.46 || ^13.0End of life
1.x^8.1^10.0 || ^11.0 || ^12.0 || ^13.0End of life

Start with Laravel JSON:API

Install it, follow the quick start, and see your first result in minutes.

Works with

Laravel API Revisions
Typed schemas for Laravel resources and form requests, evolved through dated API revisions, Stripe-style.
v1.0.0ark4ne/laravel-api-revisions
Laravel OpenAPI Generator
Generates OpenAPI 3.0, 3.1 and 3.2 documents from a Laravel application, its routes, form requests and resources.
v1.2.0ark4ne/laravel-openapi-generator