danhunsaker / laravel-flysystem-others
自动注册它所识别的每个第三方 Flysystem 适配器,作为 Laravel 文件系统驱动。
Requires
- danhunsaker/laravel-flysystem-service: ^1.4
- illuminate/filesystem: >= 5.0
- illuminate/support: >= 5.0
- league/flysystem: ^1.0
Requires (Dev)
- phpunit/phpunit: ^8.5
Suggests
- aliyuncs/aliyun-oss-flysystem: One of the options to use the 'oss' adapter (^1.2)
- aobozhang/aliyun-oss-adapter: One of the options to use the 'oss' adapter (^1.0)
- apollopy/flysystem-aliyun-oss: One of the options to use the 'oss' adapter (^1.2)
- argentcrusade/flysystem-selectel: Required to use the 'selectel' adapter (^1.2)
- arhitector/yandex-disk-flysystem: Required to use the 'yandex' adapter (^1.0)
- boofw/flysystem-qiniu: One of the options to use the 'qiniu' adapter (^1.0)
- carlosocarvalho/flysystem-cloudinary: One of the options to use the 'cloudinary' adapter (^1.0)
- cedricziel/flysystem-gcs: One of the options to use the 'google' adapter (^2.0)
- danhunsaker/flysystem-redis: Required to use the 'redis' adapter (^1.0)
- emgag/flysystem-tempdir: Required to use the 'temp' adapter (^0.1)
- engineor/flysystem-runabove: Required to use the 'runabove' adapter (^1.0)
- enl/flysystem-cloudinary: One of the options to use the 'cloudinary' adapter (^1.1)
- eqingdan/flysystem-qiniu: One of the options to use the 'qiniu' adapter (^0.1)
- freyo/flysystem-qcloud-cos-v3: One of the options to use the 'qcloud' adapter (^)
- freyo/flysystem-qcloud-cos-v4: One of the options to use the 'qcloud' adapter (^)
- freyo/flysystem-qcloud-cos-v5: One of the options to use the 'qcloud' adapter (^)
- ignited/flysystem-google-drive: One of the options to use the 'gdrive' adapter (dev-master)
- ignited/flysystem-onedrive: One of the options to use the 'onedrive' adapter (dev-master)
- integral/flysystem-pdo-adapter: One of the options to use the 'pdo' adapter (^1.0)
- jacekbarecki/flysystem-onedrive: One of the options to use the 'onedrive' adapter (^1.0)
- jellybool/flysystem-upyun: Required to use the 'upyun' adapter (^1.0)
- kapersoft/flysystem-sharefile: Required to use the 'sharefile' adapter (^1.1)
- litipk/flysystem-fallback-adapter: Required to use the 'fallback' adapter, and with league/flysystem-replicate-adapter, the 'mirror' adapter (^0.1)
- mgriego/flysystem-clamav: Scans files for viruses before storing them on an actual filesystem (^1.0)
- mhetreramesh/flysystem-backblaze: Required to use the 'backblaze' adapter (^1.1)
- monster/flysystem-aliyun-oss: One of the options to use the 'oss' adapter, but not recommended, since it uses the League namespace without being a Leage package (^1.0)
- nao-pon/flysystem-google-drive: One of the options to use the 'gdrive' adapter (^1.1)
- nicolasbeauvais/flysystem-onedrive: One of the options to use the 'onedrive' adapter (^1.0)
- nimbusoft/flysystem-openstack-swift: Required to use the 'openstack' adapter (^0.2)
- orzcc/aliyun-oss: One of the options to use the 'oss' adapter (dev-master)
- overtrue/flysystem-qiniu: One of the options to use the 'qiniu' adapter (^1.0)
- phlib/flysystem-pdo: One of the options to use the 'pdo' adapter (^1.1)
- potherca/flysystem-github: Required to use the 'github' adapter (^0.2)
- private-it/flysystem-google-drive: One of the options to use the 'gdrive' adapter (dev-master)
- robgridley/flysystem-smb: Required to use the 'smb' adapter (dev-master)
- rokde/flysystem-local-database-adapter: Required to use the 'eloquent' adapter (^0.0)
- shion/aliyun-oss: One of the options to use the 'oss' adapter (dev-master)
- spatie/flysystem-dropbox: Required to use the 'dropbox' adapter in PHP 7 (^1.0)
- srmklive/flysystem-dropbox-v2: Required to use the 'dropbox' adapter in PHP 5 (^1.0)
- superbalist/flysystem-google-storage: One of the options to use the 'google' adapter (^7.0)
- t3chnik/flysystem-cloudinary-adapter: One of the options to use the 'cloudinary' adapter (dev-master)
- twistor/flysystem-guzzle: One of the options to use the (read-only) 'http' adapter (^6.0)
- twistor/flysystem-http: One of the options to use the (read-only) 'http' adapter (^0.2)
- twistor/flysystem-stream-wrapper: Allows access to Flysystem drives using 'drive://path' streams (^1.0)
- xxtime/flysystem-aliyun-oss: One of the options to use the 'oss' adapter (^1.2)
- zhuxiaoqiao/flysystem-baidu-bos: Required to use the 'bos' adapter (^1.0)
README
自动注册被识别的第三方 Flysystem 适配器。
这允许你使用第三方适配器,无需编写自己的服务提供者来正确加载它们。它自动检测哪些适配器可用,并仅注册已安装的适配器。它还检测是否可用 Eventable 版本的 Flysystem,如果是,则切换到该版本,让你可以监听 Flysystem 事件 并相应地影响它们。
注意:虽然此包仅识别由 The PHP League 官方不支持 的适配器,但它 确实 依赖于 danhunsaker/laravel-flysystem-service,因此安装此包 将 允许你使用它们。
安装
这里适用了使用 Composer 的常规方法
composer require danhunsaker/laravel-flysystem-others
此包使用 Laravel 的服务提供者自动发现功能,但如果你正在使用 5.5 之前的 Laravel 版本,你仍然需要注册一个服务 - 但只需要一个,至少你不需要 编写 它。务必 替换 Illuminate\Filesystem\FilesystemServiceProvider::class
行为新的行
// In config/app.php 'providers' => [ // ... Danhunsaker\Laravel\Flysystem\FlysystemOtherServiceProvider::class, // ... ],
由于 FlysystemOtherServiceProvider
扩展自 danhunsaker/laravel-flysystem-service
中的 FlysystemServiceProvider
,因此你也不需要添加它。实际上,这样做可能会在你的应用程序中引起一些问题,因为两个提供者将同时尝试处理 PHP League 驱动程序。
当然,你还需要阅读其 README
,以了解它支持哪些选项,这个包可以依赖,例如缓存装饰器的选项。
设置
为了增加灵活性,例如在远程存储上打开 ZIP 文件的能力,你还可以安装 twistor/flysystem-stream-wrapper,该工具会将你的 config/filesystems.php
文件中的每个驱动程序注册为流协议(尽管只有在首次访问时才会这样做,除非你在配置中将它们添加到 autowrap
参数中)。在访问远程 ZIP 文件的示例中,你只需在 ZIP 文件的路径前加上它可用的驱动程序名称,作为 URL 方案(例如 dropbox://path/to/file.zip
)。
最后,与 danhunsaker/laravel-flysystem-service
一样,你可以通过发布替换的 filesystems
配置来获取所有支持文件系统驱动程序的示例定义 - 只需运行以下 Artisan 命令
php artisan vendor:publish --provider=Danhunsaker\\Laravel\\Flysystem\\FlysystemOtherServiceProvider --force
需要 --force
标志来覆盖 Laravel 一起提供的现有 filesystems
配置。如果你希望保留现有内容以传输到新文件,你也可以重命名现有文件,然后不使用 --force
标志运行命令。
支持的适配器
检查此软件包支持哪些适配器的最佳位置是Composer建议,但这里也提供了一个快速(不一定是最新的)列表。
-
阿里云OSS: aliyuncs/aliyun-oss-flysystem, aobozhang/aliyun-oss-adapter, apollopy/flysystem-aliyun-oss, orzcc/aliyun-oss, shion/aliyun-oss, xxtime/flysystem-aliyun-oss, monster/flysystem-aliyun-oss(只有在没有其他
oss
适配器的情况下才使用,因为它使用了League
命名空间,但不是PHP League包) -
Backblaze B2: mhetreramesh/flysystem-backblaze
-
Citrix ShareFile: kapersoft/flysystem-sharefile
-
ClamAV(病毒扫描): mgriego/flysystem-clamav
-
Cloudinary: carlosocarvalho/flysystem-cloudinary, enl/flysystem-cloudinary, t3chnik/flysystem-cloudinary-adapter
-
Eloquent: rokde/flysystem-local-database-adapter
-
GitHub: potherca/flysystem-github
-
Google Cloud Storage: cedricziel/flysystem-gcs, superbalist/flysystem-google-storage
-
Google Drive: ignited/flysystem-google-drive, nao-pon/flysystem-google-drive, private-it/flysystem-google-drive(优先级高于
nao-pon
) -
HTTP(只读): twistor/flysystem-guzzle, twistor/flysystem-http
-
镜像:一个“元适配器”,如果两个都可用,它将结合后备和复制适配器。
-
OneDrive: ignited/flysystem-onedrive, jacekbarecki/flysystem-onedrive, nicolasbeauvais/flysystem-onedrive
-
OpenStack Swift: nimbusoft/flysystem-openstack-swift
-
腾讯云COS: freyo/flysystem-qcloud-cos-v5, freyo/flysystem-qcloud-cos-v4, freyo/flysystem-qcloud-cos-v3(此适配器的优先级由API版本确定,而不是按字母顺序排序)
-
七牛云存储:boofw/flysystem-qiniu,eqingdan/flysystem-qiniu,overtrue/flysystem-qiniu
-
Runabove:engineor/flysystem-runabove
-
Selectel:argentcrusade/flysystem-selectel
-
SMB/CIFS:robgridley/flysystem-smb
注意:如果您为相同的存储服务安装了上述适配器中的多个,则仅使用第一个(按命名空间字母顺序排序),除非上面另有说明。
贡献
欢迎在GitHub上提交拉取请求、错误报告等。
安全问题应直接报告给danhunsaker (plus) laraflyplus (at) gmail (dot) com。
有关其他信息,请访问GitHub。