- Can I use this Symfony Storage Bundle in Laravel without Symfony’s full framework?
- Yes, but you’ll need to manually bridge Symfony’s Dependency Injection with Laravel’s container. The bundle works independently, but you’ll need to publish its `storage.yaml` config and adapt it to Laravel’s `filesystems.php` or use a config publisher to merge them. The async AWS SDK is compatible with Laravel’s queue system for background uploads.
- How do I migrate from Laravel’s built-in Storage facade to this bundle?
- Replace `Storage::disk('s3')->put()` calls with `Storage $storage` injection and use the bundle’s `upload()`/`write()` methods. Update your `config/filesystems.php` to include the bundle’s drivers, then bind the Symfony `Storage` service to Laravel’s container. A config migration script can help translate `storage.yaml` to Laravel’s format.
- Does this bundle support Laravel’s Scout for full-text search?
- No, this bundle focuses on file storage, not search. For Scout integration, you’d need to pair it with a separate search service (e.g., Algolia, Meilisearch) and handle metadata storage via Laravel’s database or this bundle’s local/cloud drivers. The bundle’s async AWS SDK won’t directly support Scout’s indexing.
- Will this work with Laravel 10+ and PHP 8.4+?
- The bundle requires Symfony 8 and PHP 8.4+, which aligns with Laravel 10’s compatibility. However, Laravel’s container integration may need adjustments (e.g., service binding tweaks). Test thoroughly with Laravel’s `Storage::fake()` for local driver mocking, as cloud providers (R2/B2) require real credentials in CI.
- How do I handle errors when Cloudflare R2 or BackBlaze B2 fails?
- The bundle throws Symfony’s `StorageException`, which may not map cleanly to Laravel’s error handling. Create a custom exception mapper or middleware to convert these to Laravel’s `HttpException` or log them via `report()` in a custom handler. Implement fallback logic (e.g., local disk) in your application code for critical operations.
- Can I use this for high-traffic Laravel apps with concurrent uploads?
- The async AWS SDK improves scalability, but Symfony’s DI may not handle Laravel’s concurrent requests optimally. Use stateless drivers (e.g., per-request `Storage` instances) or Laravel’s queue system to offload uploads. Benchmark against Laravel’s synchronous AWS SDK to compare performance under load.
- Is there a way to avoid duplicating config between Laravel and Symfony’s storage.yaml?
- Yes, publish the bundle’s config (`php artisan vendor:publish --tag=storage-bundle-config`) and merge `storage.yaml` into Laravel’s `config/filesystems.php`. Use a config publisher or a custom service provider to automate this. For dynamic environments, consider environment-specific config files (e.g., `.env`-driven overrides).
- How do I test this bundle in Laravel’s CI without real cloud credentials?
- Use Laravel’s `Storage::fake()` for local driver tests. For cloud providers (R2/B2), mock the `StorageInterface` or use temporary credentials with short-lived access keys. Store sensitive keys in CI secrets and restrict tests to the local driver unless absolutely necessary.
- Are there alternatives to this bundle for Laravel cloud storage?
- Laravel’s built-in `aws`, `s3`, and `s3-v3` drivers cover basic S3-compatible storage, but lack async support and multi-provider flexibility. For R2/B2, consider `spatie/laravel-backblaze-b2` or `cloudflare/laravel-r2` for tighter Laravel integration. This bundle’s strength is its Symfony-based abstraction for mixed environments.
- How do I add custom storage drivers (e.g., DigitalOcean Spaces) to this bundle?
- Extend the `StorageInterface` and implement a new driver class. Register it in the bundle’s `services.yaml` and update the config schema. Document the extension points in your team’s wiki, as the bundle’s low adoption means community examples are scarce. Test thoroughly with Laravel’s container binding.