mzur / flysystem-openstack-swift
v1.1.0
2019-09-17 10:50 UTC
Requires
- league/flysystem: ^1.0
- php-opencloud/openstack: ^3.0
Requires (Dev)
- mikey179/vfsstream: ^1.6.4
- mockery/mockery: ^0.9.5
- phpunit/phpunit: ^5.5
README
OpenStack Swift 的 Flysystem 适配器。
存档。请使用 nimbusoftltd/flysystem-openstack-swift。
安装
composer require mzur/flysystem-openstack-swift
用法
$openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', 'user' => [ 'id' => '{userId}', 'password' => '{password}' ], 'scope' => ['project' => ['id' => '{projectId}']] ]); $container = $openstack->objectStoreV1() ->getContainer('{containerName}'); $adapter = new Nimbusoft\Flysystem\OpenStack\SwiftAdapter($container); $flysystem = new League\Flysystem\Filesystem($adapter);
配置
Swift 适配器允许您配置上传 大对象 的行为。您可以设置以下配置选项
swiftLargeObjectThreshold
: 文件大小(字节),超过该大小将切换到大对象上传过程。默认是 300 MiB。常规对象的最大允许大小是 5 GiB。swiftSegmentSize
: 大文件拆分成的单个段或块的大小。默认是 100 MiB。应小于 5 GiB。swiftSegmentContainer
: 存储大对象段的 Swift 容器名称。默认与存储常规文件的容器相同。
示例
$flysystem = new League\Flysystem\Filesystem($adapter, new \League\Flysystem\Config([ 'swiftLargeObjectThreshold' => 104857600, // 100 MiB 'swiftSegmentSize' => 52428800, // 50 MiB 'swiftSegmentContainer' => 'mySegmentContainer', ]));