Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Storage Bundle

Storage Bundle Laravel Package

1tomany/storage-bundle

Symfony bundle for uploading files to remote storage (Amazon S3/R2, GCS, Azure) with a simple client-based config. Includes an Amazon S3-compatible client plus a mock client for fast, offline testing, and optional custom URLs for CDN/public buckets.

View on GitHub
Deep Wiki
Context7

Symfony bundle to manage uploading and downloading files to and from remote storage services

Frequently asked questions about Storage Bundle
Can I use this bundle directly in Laravel without Symfony?
Yes, but you’ll need to manually bind the bundle’s services to Laravel’s container. The bundle’s Symfony-first design works with Laravel since Laravel uses Symfony components, but you’ll need to adapt Symfony’s `UploadRequest` to Laravel’s `UploadedFile` and register the bundle’s service provider in `config/app.php`.
How do I configure this for Cloudflare R2 in Laravel?
Use the `custom_url` setting in `onetomany_storage.yaml` to override R2’s default URLs with your R2 account domain (e.g., `https://account-id.r2.cloudflarestorage.com`). Ensure your `.env` has `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` for R2, just like S3.
Does this bundle support Laravel’s Filesystem contracts (e.g., `Storage::disk()`)?
No, it doesn’t natively. You’ll need to create a wrapper facade or extend the bundle’s `ClientInterface` to implement Laravel’s `Filesystem` contract. This lets you use `Storage::disk('s3')->put()` while leveraging the bundle’s underlying client.
How do I mock S3 uploads in Laravel’s PHPUnit tests?
Use the bundle’s `mock_client` configuration and inject a mock implementation of `ClientInterface`. For Laravel, you can use Pest or Mockery to stub the client’s methods (e.g., `upload()`) and bypass real S3 calls entirely during testing.
Will this work with Laravel Vapor or Forge?
Not out of the box. Vapor/Forge rely on Laravel’s native `Storage` facade and AWS SDK. You’d need to manually integrate the bundle’s client into Vapor’s deployment or Forge’s provisioning scripts, likely by extending Laravel’s `FilesystemManager` to use the bundle’s client.
How do I handle Laravel’s `UploadedFile` vs. Symfony’s `UploadedFile`?
Create an adapter class to convert Laravel’s `UploadedFile` to Symfony’s `UploadedFile` (or vice versa). For example, extract the file path, MIME type, and size from Laravel’s `UploadedFile` and pass it to the bundle’s `UploadActionInterface`. This is a common pattern in Laravel-Symfony hybrid apps.
Is this bundle compatible with Laravel 10+?
Yes, but test thoroughly. The bundle depends on Symfony 6/7, which Laravel 10+ supports. Watch for version conflicts with Laravel’s Symfony components (e.g., `symfony/http-foundation`). Use `composer.json` overrides or Laravel’s `config/extra.php` to enforce compatible versions.
Can I use this for chunked uploads or large file handling?
The bundle doesn’t include chunked upload logic natively. For large files, rely on the underlying AWS SDK (e.g., `aws/aws-sdk-php-symfony`) or implement a custom `UploadActionInterface` that uses Laravel’s `ChunkUpload` or a queue-based approach (e.g., `UploadFileJob`).
What are the alternatives to this bundle for Laravel?
For Laravel-specific solutions, consider `fruitcake/laravel-aws` (S3-focused), `spatie/laravel-google-drive-disk` (GCS), or `league/flysystem-aws-s3` (low-level Flysystem adapter). These integrate directly with Laravel’s `Storage` facade but lack the bundle’s multi-cloud abstraction or mock testing.
How do I secure AWS credentials in Laravel with this bundle?
Store credentials in Laravel’s `.env` (e.g., `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`) and reference them in the bundle’s `amazon_client` config. For production, use Laravel’s `Vapor` or `Envoy` for secret rotation, or integrate with `spatie/laravel-envoy` for encrypted credentials.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope