dittto/symfony-custom-request
Pros:
Cons:
AppKernel, Symfony’s DI container, and Symfony’s request stack). Laravel’s ecosystem (e.g., Illuminate\Http\Request, service container) differs significantly.Illuminate\Validation\Validator, Form Requests), making this package redundant unless custom logic is needed.Request class differs from Symfony’s RequestStack/Request.AppKernel, while Laravel uses AppServiceProvider or register() in AppServiceProvider.Request in a Laravel-compatible facade, but this would be fragile and high-maintenance.php artisan make:request) or custom validation logic in service classes instead.Why Symfony-specific?
Validation Complexity
Validator?Long-term Viability
Team Expertise
Poor fit for Laravel:
Illuminate\Http\Request) is incompatible with Symfony’s RequestStack.Illuminate\Container\Container) differs from Symfony’s DependencyInjection.Composer autoloading, not AppKernel.Potential Workarounds (Not Recommended):
symfony/http-kernel), but this is overkill for validation.CustomRequest trait/class), but this recreates the wheel.Assess Alternatives First:
php artisan make:request) for controller-level validation.Illuminate\Http\Resources) for structured responses.Validator::extend()) for dynamic rules.If Integration is Mandatory:
RequestStack with Laravel’s Request).AppKernel registration with a Laravel service provider.Validator or FormRequest.Sequencing:
Symfony-Specific Components:
| Component | Laravel Equivalent | Compatibility Risk |
|---|---|---|
RequestStack |
Illuminate\Http\Request |
High (API mismatch) |
AppKernel |
AppServiceProvider |
High (registration) |
| Symfony DI | Laravel Container | Medium (bindings) |
| EventDispatcher | Laravel Events | Low (similar API) |
Laravel-Specific Gaps:
| Failure Scenario | Likelihood | Impact | Mitigation |
|---|---|---|---|
| Package breaks with PHP 8.x | High | Critical | Replace with Laravel-native |
| Symfony API changes | High | Critical | Avoid integration |
| Custom port introduces bugs | Medium | High | Strict testing (PHPUnit) |
| Team lacks Symfony expertise | High | High | Use Laravel’s documented tools |
How can I help you explore Laravel packages today?