masbug/flysystem-google-drive-ext
Flysystem adapter for Google Drive that hides Google’s file/folder IDs by translating between virtual ID paths and human-friendly display paths. Supports Flysystem v2/v3 (Laravel 9+) with seamless path mapping for common filesystem operations.
Strengths:
Storage facade). This aligns with Laravel’s modular design, allowing seamless integration into existing storage backends (e.g., filesystems.php config).AfterWrite, AfterDelete) can be extended for auditing, notifications, or sync logic, adding value to Laravel’s event ecosystem.Weaknesses:
google/apiclient), which may introduce complexity in OAuth2 flows, rate limits, or quota management. Requires careful handling of credentials (e.g., service accounts vs. OAuth tokens).league/flysystem-* packages, this lacks first-party Laravel support (e.g., no FilesystemManager integration), requiring manual setup.Storage facade, filesystem helper, and FilesystemManager. Can replace or extend existing disks (e.g., google disk in config/filesystems.php).StoreFileJob using the adapter).Filesystem interface.https://drive.google.com/...) will need updates to use virtual paths (e.g., /My Nice Dir/file.ext)./, ?) or Unicode filenames. Testing required for edge cases like:
/Dir?/File.txt).env(), Vault)?scheduler)?App\Exceptions\Handler?google/apiclient mocks)?google disk in config/filesystems.php:
'disks' => [
'google' => [
'driver' => 'flysystem',
'adapter' => Masbug\FlysystemGoogleDriveExt\GoogleDriveAdapter::class,
'options' => [
'client' => new Google_Client(['auth' => 'service_account.json']),
'root_id' => env('GOOGLE_DRIVE_ROOT_ID'),
'virtual_root' => '/',
],
],
],
AppServiceProvider or a dedicated GoogleDriveServiceProvider:
public function register()
{
$this->app->singleton(GoogleDriveAdapter::class, function ($app) {
return new GoogleDriveAdapter(
$app['google.client'],
env('GOOGLE_DRIVE_ROOT_ID')
);
});
}
env() for credentials (e.g., GOOGLE_APPLICATION_CREDENTIALS).flysystem.file.written) via Laravel’s Events facade for auditing or notifications:
event(new FileUploaded($virtualPath, $file));
google/apiclient v2.0+. Ensure the API version matches the package’s dependencies.Storage::disk('google')->put('raw/path', ...) must update to virtual paths (e.g., '/My Dir/file.ext').FilesystemInterface) remains unchanged.league/flysystem (e.g., spatie/laravel-medialibrary) will work if configured to use the google disk.composer require masbug/flysystem-google-drive-ext google/apiclient.config/filesystems.php and .env.How can I help you explore Laravel packages today?