alexfigures/symfony-jsonapi-bundle
Pros:
fields parameter).Cons:
DELETE 200 OK (JSON:API MAY requirements) are not implemented, which may require custom logic for advanced use cases.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.EventDispatcher, HttpFoundation) to work with Laravel’s ecosystem. Risk of missed edge cases in abstraction layers.EventSubscriber, ParameterBag) may slow initial adoption.DELETE 200 OK critical?
DELETE 200 OK, higher for cursor pagination).Auth, Gate, or Policy systems.make test commands may need adaptation for Laravel’s 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 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.laravel/json-api for Laravel-specific JSON:API assertions.Article) to validate the integration.DELETE 200 OK).How can I help you explore Laravel packages today?