iclimber / laravel-supabase-flysystem
Supabase 驱动器用于 Laravel Flysystem 存储
1.0.1
2024-09-04 09:22 UTC
Requires
- php: ^8.1
- ext-fileinfo: *
- guzzlehttp/guzzle: ^7.2
- illuminate/contracts: ^10.0|^11.0
- illuminate/filesystem: ^10.0|^11.0
- illuminate/http: ^10.0|^11.0
- illuminate/support: ^10.0|^11.0
- league/flysystem: ^3.0
Requires (Dev)
- larastan/larastan: ^2.0.1
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.8
- orchestra/testbench: ^8.8
- pestphp/pest: ^2.20
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
README
使用此 Flysystem 适配器,轻松将 Supabase 集成到 Laravel 作为存储驱动程序。
使用 Laravel 方便的存储系统简化文件存储和检索,同时利用 Supabase 的强大功能。
要求
- PHP >= 8.1
- Laravel 10.x|11.x
- Fileinfo
ext-fileinfo
安装
要安装此包,请使用 Composer
composer require quix-labs/laravel-supabase-flysystem
配置
安装后,在 Laravel 的 config/filesystems.php
中配置 Supabase 驱动程序。
将以下内容添加到 disks 数组中
'supabase' => [ 'driver' => 'supabase', 'key' => env('SUPABASE_STORAGE_KEY'), // Use a privileged key; read-only does not work 'bucket' => env('SUPABASE_STORAGE_BUCKET'), 'endpoint' => env('SUPABASE_STORAGE_ENDPOINT'), 'url' => null, // <- Automatically generated; change here if you are using a proxy 'public' => true, // Default to true 'defaultUrlGeneration' => null, // 'signed' | 'public' <- default depends on public 'defaultUrlGenerationOptions' => [ 'download' => false, 'transform' => [], ], 'signedUrlExpires' => 60*60*24, // 1 day <- default to 1 hour (3600) ],
用法
// Example code for using the Supabase driver with Laravel Storage Storage::disk('supabase')->put('file.txt', 'contents'); // Custom function to generate a public URL Storage::disk('supabase')->getAdapter()->getPublicUrl('completelyPublicFile.png', [ 'download' => false, // Set this to true if you want the user's browser to automatically trigger download // Transform only applied if the file is detected as an image; else ignored 'transform' => [ 'width' => 200, //... All options -> https://supabase.com/docs/guides/storage/serving/image-transformations#transformation-options ]]); // Custom function to generate a signed URL Storage::disk('supabase')->getAdapter()->getSignedUrl('veryConfidentialFile.png', [ 'expiresIn' => 60 * 5, // 5 minutes //... Same options as getPublicUrl ]);
变更日志
请参阅 CHANGELOG 了解最近的变化。
致谢
许可证
MIT 许可证 (MIT)。请参阅 许可证文件 了解更多信息。