spatie/laravel-google-cloud-storage
Laravel 9+ Google Cloud Storage filesystem driver using Flysystem v3 and a dedicated GCS adapter. Adds a gcs disk with service account key file/array support, project and bucket config, path prefixes, endpoints, and public/private visibility options.
filesystem config, Storage facade), ensuring seamless compatibility with existing Laravel applications. This aligns perfectly with Laravel’s modular design, where storage drivers (e.g., local, s3) are interchangeable via configuration.v1), adding complexity if supporting multiple versions.composer require spatie/laravel-google-cloud-storage
php artisan vendor:publish --provider="Spatie\GoogleCloudStorage\GoogleCloudStorageServiceProvider"
Configuration is straightforward via .env and config/filesystems.php.Storage facade (e.g., Storage::disk('gcs')->put()).laravel-medialibrary) if they support filesystem abstraction.google/cloud-storage PHP SDK (auto-installed via Composer), which may need explicit IAM permissions (e.g., storage.objectAdmin for full CRUD).google/cloud-storage SDK may introduce breaking changes. The package abstracts this well, but monitor SDK updates for compatibility.local for dev, gcs for prod) via config/filesystems.php.local, s3) via Laravel logs or Storage::allDisks().Storage facade) that may need testing.disk() method to switch specific filesystems:
// config/filesystems.php
'disks' => [
'gcs' => [
'driver' => 'gcs',
'bucket' => env('GCS_BUCKET'),
'project_id' => env('GCS_PROJECT_ID'),
// ...
],
];
Storage::disk('local')->... calls to use gcs.Storage::put(), Storage::get()).links()).Storage::response()).Storage facade (e.g., spatie/laravel-medialibrary, intervention/image).Storage::path('file.txt') instead of Storage::disk('gcs')->path()).google/cloud-storage SDK.storage.admin for testing)..env and config/filesystems.php.spatie/laravel-google-cloud-storage for Laravel/Flysystem version compatibility.google/cloud-storage SDK as needed (minor updates are usually safe; major updates require testing).env() helper for dynamic bucket/project IDs.Storage::disk('gcs')->getAdapter()->getClient() to inspect the underlying GCS client.queue:work) may need scaling for parallel uploads.Cache::remember) for frequently accessed files.| Failure Scenario | Impact | **Mitigation
How can I help you explore Laravel packages today?