nao-pon/flysystem-google-drive
Laravel Flysystem adapter for Google Drive. Store, read, list, update and delete files on Drive using Flysystem’s filesystem API, with support for service accounts or OAuth. Ideal for using Google Drive as a cloud disk in Laravel apps.
Strengths:
league/flysystem), enabling seamless adoption for file storage in Google Drive.Fit for Laravel Ecosystem:
Storage facade (e.g., Storage::disk('google')->put()).filesystem.stored, filesystem.deleted) for workflow automation.Potential Gaps:
flysystem-cache or Laravel’s Cache facade).Prerequisites:
league/flysystem (Laravel includes this by default) and google/apiclient (composer dependency).Laravel-Specific Setup:
config/filesystems.php:
'disks' => [
'google' => [
'driver' => 'google',
'bucket' => 'your-bucket-id', // Optional: For shared drives
'team_drive_id' => env('GOOGLE_DRIVE_TEAM_DRIVE_ID'),
'client_config_path' => env('GOOGLE_DRIVE_CREDENTIALS_PATH'),
'root_folder_id' => env('GOOGLE_DRIVE_ROOT_FOLDER_ID'),
],
],
GOOGLE_DRIVE_CREDENTIALS_PATH=path/to/service-account.json
GOOGLE_DRIVE_TEAM_DRIVE_ID=your-team-drive-id
Testing Complexity:
VentureCraft/revisionable or custom test doubles.spatie/laravel-rate-limiting).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Google API quota exhaustion | High | Implement exponential backoff + caching. |
| Permission/access issues | Medium | Use service accounts with least-privilege roles. |
| Shared drive limitations | Medium | Validate team_drive_id in CI/CD. |
| PHP version compatibility | Low | Pin google/apiclient to a stable version. |
| No native CDN support | Low | Use Cloudflare or Laravel’s Cache facade. |
Storage facade, Filesystem events, and Vapor/Forge deployments.google-drive:upload).public.google for user uploads).Storage::copy() to move existing files:
Storage::disk('local')->copy('file.txt', 'google:file.txt');
team_drive_id config (not all features work in personal drives).FileLock or database tracking).https://www.googleapis.com/auth/drive).config/filesystems.php and .env.Storage::disk('google')->put('test.txt', 'Hello').Storage::disk('google')->visibility()).403 Forbidden, 429 Too Many Requests).google/apiclient: Update periodically (major versions may break compatibility).google_drive.log) for debugging:
\Log::channel('google_drive')->info('File uploaded', ['file' => $file]);
client_config_path and IAM roles.root_folder_id or team drive permissions.How can I help you explore Laravel packages today?