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.
Compatibility
PHP 8.3 and Laravel 12.46 or later.
| Version | PHP | Laravel | Status |
|---|---|---|---|
| 3.x | ^8.3 | ^12.46 || ^13.0 | Active |
| 2.x | ^8.3 | ^12.46 || ^13.0 | End of life |
| 1.x | ^8.1 | ^10.0 || ^11.0 || ^12.0 || ^13.0 | End of life |
Start with Laravel JSON:API
Install it, follow the quick start, and see your first result in minutes.