PHP code example of treehouselabs / swift-client

1. Go to this page and download the library: Download treehouselabs/swift-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

treehouselabs / swift-client example snippets


// use `treehouselabs/keystone-client` to initialize a Guzzle Client that can
// communicate with Keystone-authenticated services
$driver = new SwiftDriver($keystoneClient);
$store  = new ObjectStore($driver);

// create a new container and object
$container = $store->createContainer('foo');
$object = $store->createObject($container, 'bar');

// set a local file to the object
$object->setLocalFile($file);

// update the object in the store
$store->updateObject($object);


// ...

// get the stored container/object
$container = $store->getContainer('foo');
$object = $container->getObject('bar);

// get the contents
$store->getObjectContent($object);