- Does this package work with Laravel, or is it Symfony-focused?
- This package is Symfony-based but can be used in Laravel. However, the recent Symfony 6 support adds irrelevant complexity for Laravel projects. Stick with it only if you need its specific helpers (e.g., typed exceptions, JSON responses) and confirm no Symfony dependencies conflict with Laravel’s existing packages.
- Will this package introduce Symfony dependencies that clash with Laravel?
- Yes, there’s a risk. Run `composer why-not atournayre/helpers` to check for conflicts with Laravel’s Symfony components (e.g., `symfony/mailer`). If Symfony packages appear, avoid it unless you explicitly need them. Prefer native Laravel tools like `Str`, `Arr`, or `Carbon` for basic utilities.
- How do I install this in Laravel without breaking existing Symfony packages?
- Use `composer require atournayre/helpers` in a staging environment first. Audit dependencies with `composer why atournayre/helpers` to spot Symfony packages. If conflicts arise, exclude the package or use alternatives like `spatie/array` for array helpers or custom solutions for Laravel-specific needs.
- What Laravel versions does this package support?
- The package officially supports Laravel 8/9/10 (PHP 8.0+). Symfony 6 compatibility is irrelevant for Laravel unless you’re mixing Symfony components. Test thoroughly in your Laravel version to ensure no breaking changes, especially if using Symfony’s DI or event systems.
- Can I use the Twig EnumExtension in Laravel’s Blade templates?
- No, the Twig extension is for Symfony’s Twig environment. Laravel uses Blade, so this feature is unusable unless you’re integrating Symfony’s Twig separately. For Blade, consider custom directives or libraries like `spatie/laravel-blade-components` for enum-like logic.
- How do I configure FlashService for Laravel’s session-based flash messages?
- FlashService requires Symfony’s `RequestStack`, which may conflict with Laravel’s session. Configure it via `config/services.yaml` as shown in the README, but test if it works with Laravel’s session driver. If issues arise, use Laravel’s native `session()->flash()` or alternatives like `spatie/laravel-flash`.
- Are there Laravel-specific alternatives to this package’s helpers?
- Yes. For JSON responses, use Laravel’s `response()->json()`. For typed exceptions, extend Laravel’s `Exception` class. For flash messages, use `session()->flash()`. For array/string helpers, prefer `Str`, `Arr`, or `spatie/array`. This package only adds value if you need its *explicit* Symfony-based utilities.
- How do I test this package in a Laravel project?
- Mock critical classes (e.g., `FlashService`, `JsonResponseHelper`) and test edge cases like multibyte strings or nested arrays. Since it’s Symfony-dependent, ensure your tests don’t rely on Laravel’s session or DI. Use `composer test` if the package includes tests, but expect minimal Laravel-specific coverage.
- Will this package slow down my Laravel app due to Symfony overhead?
- Possibly. Symfony components (e.g., `RequestStack`, `HttpFoundation`) add dependency injection and event overhead. Benchmark your app before/after installation. If performance drops, remove unused Symfony features or switch to lighter alternatives like `nesbot/carbon` for dates or custom helpers.
- Is this package actively maintained for Laravel?
- No. The changelog shows minimal activity (1 PR in 6+ months), and Symfony 6 support suggests a shift away from Laravel. Use it cautiously, as future updates may prioritize Symfony over Laravel compatibility. Monitor the repo for Laravel-specific fixes or consider forking it if critical issues arise.