Skip to content

raoptimus/yii2-openstack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stable Version Untable Version License Total Downloads Build Status

yii2-openstack

Openstack / swift client for Yii2 Framework

Installation

Install with composer:

composer require raoptimus/yii2-openstack

Usage samples

Configuration

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

Use connection

$swift = \Yii::$app->get('swift');
$container = $swift->getContainer('name of container');

Push file to swift storage

$container->pushObject($source, $target);

Pull file from swift storage

$container->pullObject($source, $target);

Get stat of file from swift storage

$container->getObject($filename);

Exists file in swift storage

$container->existsObject($filename);

Delete file from swift storage

$container->deleteObject($filename);