spatie/flysystem-google-cloud-storage
Google Cloud Storage adapter for Flysystem v1 (PHP 8). A maintained fork adding modern PHP support and merged fixes. Use it to connect Flysystem’s filesystem API to GCS with Google’s client authentication.
spatie/flysystem-google-cloud-storage-v2 or the official google/cloud-storage SDK."This package lets us leverage Google Cloud Storage for our Laravel app’s file storage—without rewriting our existing codebase. Key benefits:
- Cost savings: GCS’s tiered storage (e.g., $0.004/GB/month for Coldline) could cut storage costs by 30–50% vs. S3 for archival data.
- Scalability: Handles unlimited growth for user uploads/media without local infrastructure.
- Compliance: Store data in region-specific buckets (e.g., EU) to meet GDPR/local laws.
- Risk reduction: Avoids vendor lock-in by using Flysystem’s standard interface—we can switch providers later if needed. Implementation is low-risk: It’s a drop-in replacement for existing storage logic, with no downtime. The team estimates <2 weeks to integrate and test. ROI comes from operational savings and future flexibility."
"This is a mature, battle-tested Flysystem adapter for GCS, tailored for Laravel 8.x. Why use it?
- Proven reliability: Built on the official Google Cloud Storage PHP SDK, with Spatie’s reputation for quality.
- Performance: Optimized for high-throughput operations (e.g., batch uploads, CDN caching).
- Security: Inherits GCS’s IAM, encryption (AES-256), and VPC Service Controls.
- Dev velocity: No custom SDK work—just configure credentials and bucket names. Example setup:
use Spatie\FlysystemGoogleCloudStorage\GoogleCloudStorageAdapter; $adapter = new GoogleCloudStorageAdapter('my-bucket', [ 'keyFilePath' => '/path/to/service-account.json', 'projectId' => 'my-gcp-project', ]); $filesystem = new \League\Flysystem\Filesystem($adapter);- Monitoring: Integrates with GCP’s native logging/metrics (e.g., Cloud Logging, Storage Analytics). Caveats: PHP 8 only; not for Flysystem v2. If we’re on Laravel 9+, we should evaluate the v2 adapter instead. For now, this is a safe, low-effort way to adopt GCS."*
Call to Action:
How can I help you explore Laravel packages today?