alexfigures/symfony-jsonapi-bundle
Production-ready JSON:API 1.1 bundle for Symfony featuring full filtering, sorting, pagination, automatic eager loading, and zero N+1 queries. 97.8% spec conformance, PHPStan level 8, PHP 8.3+ and Symfony 7.1+, with optional Doctrine ORM 3 integration.
Release reviewed: v1.0.0. Release notes state only “Stable version 1.0 of bundle”; no feature, breaking-change, migration, or Laravel-specific compatibility details were provided. TPM interpretation: this is primarily a maturity signal, not evidence of new Laravel-native capability.
Pros:
fields parameter).Cons:
DELETE 200 OK (JSON:API MAY requirements) may still require custom logic; v1.0 release notes do not confirm whether these are now implemented.symfony/http-foundation, symfony/routing, and symfony/serializer via Laravel’s Symfony Bridge (symfony/http-client, symfony/console).spatie/laravel-doctrine-orm.JsonApiEventDispatcher).YAML/XML routes → Laravel’s Route::apiResource() or Route::jsonApiResource() (custom macro).EventListener → Laravel’s Kernel middleware or Handle classes.High:
EventDispatcher, HttpFoundation) to work with Laravel’s ecosystem. Risk of missed edge cases in abstraction layers.Medium:
EventSubscriber, ParameterBag) may slow initial adoption.Low:
DELETE 200 OK now supported in 1.0?
Auth, Gate, or Policy systems.phpunit or pestphp workflows.| Layer | Symfony Bundle | Laravel Equivalent | Integration Strategy |
|---|---|---|---|
| Routing | Symfony’s routing component |
Laravel’s Route service |
Use Route::jsonApiResource() (custom macro) or api-resource package. |
| HTTP Layer | HttpFoundation |
Illuminate\Http |
Symfony Bridge (symfony/http-foundation). |
| Dependency Injection | Symfony’s DI | Laravel’s Container | Bind Symfony services to Laravel’s container via AppServiceProvider. |
| ORM | Doctrine | Eloquent | Custom repository adapter or spatie/laravel-doctrine-orm. |
| Events | Symfony’s EventDispatcher |
Laravel’s Event system |
Create a JsonApiEventDispatcher facade wrapping Symfony’s dispatcher. |
| Validation | Symfony’s Validator |
Laravel’s Validator |
Use Laravel’s validator for input; bundle’s validation for JSON:API-specific rules. |
| Serialization | Symfony’s Serializer |
Laravel’s JsonResponse/JsonSerializable |
Bundle’s serializer can output JSON:API; wrap in Laravel’s JsonResponse. |
| Testing | PHPUnit + Symfony’s test helpers | Laravel’s HttpTests/Pest |
Adapt Symfony’s test helpers (e.g., JsonApiTestCase) to Laravel’s testing utilities. |
Phase 0: v1.0.0 Impact Review (1–3 days)
Phase 1: Proof of Concept (2–4 weeks)
symfony/http-foundation, symfony/routing).JsonApiEventDispatcher to replace Symfony’s event system.Article) using Eloquent.Phase 2: Core Integration (4–6 weeks)
Route service.Accept: application/vnd.api+json).Phase 3: Advanced Features (2–4 weeks)
DELETE 200 OK).Sanctum, Passport) and caching (Redis, Cache).Phase 4: Optimization (2 weeks)
spatie/laravel-doctrine-orm or build a custom adapter.JsonApiTestCase → Adapt to Laravel’s HttpTests or Pest.Article) to validate Laravel integration.DELETE 200 OK) if not included in 1.0.Pros:
Cons:
How can I help you explore Laravel packages today?