google/cloud-storage
Idiomatic PHP client for Google Cloud Storage. Upload, download, and manage buckets/objects, set ACLs, and use the gs:// stream wrapper. Part of the Google Cloud PHP suite with full API docs and authentication guidance.
StorageEvents). It can replace Laravel’s default Filesystem contracts (Illuminate\Contracts\Filesystem\Filesystem) via a custom adapter.local disk) or S3 via Laravel’s filesystems.php configuration, enabling multi-cloud redundancy.Filesystem contract for Laravel’s Storage facade:
$storage = new Google\Cloud\Storage\StorageClient();
$adapter = new GoogleCloudStorageAdapter($storage);
app()->bind('filesystem', fn() => new Filesystem($adapter));
gs:// URLs) with cache-control headers for CDN optimization.FilesystemAdapter to support Cloud Storage metadata (e.g., contentType, customProperties)..env).rsync-like tools).upload method’s resumable option.local/s3 disks with google disk via filesystems.php.UploadFileJob).StorageEvents (e.g., file.uploaded) for post-processing.gs:// URLs with signed URLs for private content.gs://bucket/** → process video).google-cloud-storage in deploy pipelines for artifact storage.local/s3 disks with google.v1.x of the package.curl, openssl, and json (standard in PHP).aws/aws-sdk-php) or DigitalOcean Spaces.| Step | Task | Dependencies | Tools |
|---|---|---|---|
| 1 | Set up GCP project + IAM | GCP account | gcloud CLI |
| 2 | Configure Laravel filesystems.php |
GCP credentials | composer require |
| 3 | Write GoogleCloudStorageAdapter |
Laravel Filesystem contract |
PHPUnit |
| 4 | Test pilot (logs/backups) | Local storage fallback | Laravel Tinker |
| 5 | Migrate media uploads | Spatie Media Library (if used) | Artisan commands |
| 6 | Implement signed URLs | Laravel middleware | google/cloud-storage |
| 7 | Set up CDN | Cloud Load Balancing | Terraform/Console |
| 8 | Monitor costs | Budget alerts | GCP Billing |
composer update google/cloud-storage. Follow semver (GA releases are backward-compatible).storage logs for local debugging.keyFile → credentials).| Failure | Impact | Mitigation |
|---|---|---|
| GCP Outage | App downtime if no fallback | Use multi-cloud (e.g., S3 fallback) or local cache. |
| Authentication Failure | No API access | Use application default credentials + fallback to keyFile. |
| Cost Spikes | Budget overrun | Set budget alerts and quota limits. |
| Network Latency | Slow uploads/downloads | Use multi-regional buckets and CDN. |
| Permission Denied | Broken workflows | Audit IAM roles and bucket ACLs. |
| Corrupted Uploads | Data loss | Enable |
How can I help you explore Laravel packages today?