raoptimus/yii2-openstack

Yii2 框架的 Openstack/swift 客户端

安装: 440

依赖: 0

建议者: 0

安全: 0

星星: 2

关注者: 3

分支: 1

开放问题: 3

类型:yii2-extension

1.0.6 2019-10-24 15:15 UTC

README

Stable Version Untable Version License Total Downloads Build Status

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);