raoptimus / yii2-openstack
Yii2 框架的 Openstack/swift 客户端
1.0.6
2019-10-24 15:15 UTC
Requires
- php: >=7.1.0
- ext-fileinfo: *
- guzzlehttp/guzzle: ~6.0
- yiisoft/yii2: ^2.0.14
Requires (Dev)
- phpunit/phpunit: 7.*
- roave/security-advisories: dev-master
This package is auto-updated.
Last update: 2024-09-19 22:54:07 UTC
README
yii2-openstack
Yii2 框架的 Openstack / swift 客户端
安装
使用 composer 安装
composer require raoptimus/yii2-openstack
使用示例
配置
$swift = new raoptimus\openstack\Connection( new raoptimus\openstack\Options( [ 'authUrl' => 'https://somedomain.com:5000/v2.0', 'username' => '', 'apiKey' => '', 'tenant' => '', 'domain' => '', 'domainId' => '', ] ) ); $container = $swift->getContainer('name of container');
使用连接
$swift = \Yii::$app->get('swift'); $container = $swift->getContainer('name of container');
将文件推送到 swift 存储空间
$container->pushObject($source, $target);
从 swift 存储空间拉取文件
$container->pullObject($source, $target);
从 swift 存储空间获取文件状态
$container->getObject($filename);
swift 存储空间中存在文件
$container->existsObject($filename);
从 swift 存储空间中删除文件
$container->deleteObject($filename);