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
Flysystem Google Cloud Storage

Flysystem Google Cloud Storage Laravel Package

league/flysystem-google-cloud-storage

Flysystem adapter for Google Cloud Storage (GCS). Install via composer to use GCS as a filesystem in Flysystem, with full support through the main Flysystem project. See official docs for configuration and usage.

View on GitHub
Deep Wiki
Context7

league/flysystem-google-cloud-storage is the official Flysystem adapter for Google Cloud Storage (GCS), provided as a sub-split of the main thephpleague/flysystem repository. Use it to access GCS through Flysystem’s consistent filesystem API, making cloud storage interchangeable with local or other remote backends.

See the Flysystem GCS adapter docs for configuration and usage details.

  • Flysystem v3 adapter for Google Cloud Storage
  • Standardized API for read/write/list/delete operations
  • Drop-in storage backend for Laravel and PHP apps using Flysystem
  • Maintained within the upstream Flysystem project (sub-split package)
Frequently asked questions about Flysystem Google Cloud Storage
How do I configure Google Cloud Storage as a Laravel filesystem disk?
Add the disk to `config/filesystems.php` under the `disks` array with the `google` driver. Specify your bucket name, project ID, and service account key file path. Example: `'driver' => 'google', 'bucket' => env('GCS_BUCKET'), 'key_file' => storage_path('app/gcs-key.json')`. Ensure the key file has proper permissions.
Does this package support Laravel’s Storage facade (e.g., Storage::put())?
Yes, once configured as a disk, you can use Laravel’s Storage facade methods like `Storage::disk('gcs')->put()` just like any other filesystem. The adapter bridges Flysystem’s abstraction with Laravel’s filesystem interface seamlessly.
What Laravel versions and PHP versions are supported?
This package works with Laravel 8+ and requires PHP 7.4+. It relies on Flysystem v3+, which is compatible with these Laravel versions. For older Laravel versions, you may need an older Flysystem adapter version.
Can I use this for large file uploads or streaming?
Yes, the adapter supports streaming uploads and downloads, which is ideal for large files or performance-sensitive applications. This avoids memory issues by processing files in chunks rather than loading them entirely into memory.
How do I handle authentication for Google Cloud Storage in Laravel?
Authentication is typically handled via a service account JSON key file. Store the path to this file in your `.env` (e.g., `GCS_KEY_FILE=path/to/key.json`) and reference it in your filesystem configuration. For CI/CD, consider using temporary credentials via `Google_Auth_AssertionCredentials`.
Are there any known limitations or edge cases with this adapter?
The adapter lacks some GCS-specific features like lifecycle policies or CORS configuration, which must be managed directly via the Google Cloud Console. Additionally, error handling for GCS-specific issues (e.g., quota limits) may require custom logic in your Laravel application.
Can I use this alongside other Laravel storage adapters (e.g., S3)?
Yes, you can configure multiple disks in `config/filesystems.php`, including both Google Cloud Storage and S3. This allows you to route files to different backends based on your application’s needs, such as using GCS for media assets and S3 for backups.
How do I monitor performance or costs for Google Cloud Storage in Laravel?
Google Cloud provides built-in monitoring tools like Cloud Monitoring and Logging. For Laravel, you can log storage operations (e.g., uploads/downloads) using Laravel’s logging system or integrate with Google’s API for detailed metrics. Consider setting up alerts for cost thresholds or unusual activity.
What’s the best way to handle failures or downtime with Google Cloud Storage?
Implement a fallback strategy, such as caching frequently accessed files locally or using a multi-cloud approach. For transient failures, consider using a circuit breaker like `spatie/flysystem-circuit-breaker` to prevent cascading errors in your Laravel application.
Are there alternatives to this package for Laravel and Google Cloud Storage?
Yes, you could use the official Google Cloud PHP client library (`google/cloud-storage`) directly or explore other Flysystem adapters like `league/flysystem-aws-s3` for S3 compatibility. However, this package provides a Laravel-native integration with GCS, simplifying configuration and usage.
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport