2017 © Pedro Peláez
 

library laravel5-conoha-object-handler

An object handler for the Conoha Object Storage on Laravel 5.

image

okashoi/laravel5-conoha-object-handler

An object handler for the Conoha Object Storage on Laravel 5.

  • Monday, December 19, 2016
  • by okashoi
  • Repository
  • 1 Watchers
  • 3 Stars
  • 138 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Laravel 5 Conoha Object Handler

CircleCI, (*1)

Laravel 5 Package to use Conoha Object Storage., (*2)

Installation

Install the package via Composer., (*3)

composer require okashoi/laravel5-conoha-object-handler

To use the package, register the service provider in config/app.php., (*4)

    'providers' => [
        // ...
        Okashoi\Laravel5ConohaObjectHandler\ConohaObjectServiceProvider::class,
    ]

To configure your connection settings, execute the following command., (*5)

php artisan vendor:publish --provider="Okashoi\Laravel5ConohaObjectHandler\ConohaObjectServiceProvider"

Then set the following environment variables in .env file., (*6)

CONOHA_TENANT_ID
CONOHA_USERNAME
CONOHA_PASSWORD

Usage

Create the Instance

First of all you have to create an ObjectHandler instance., (*7)

use Okashoi\Laravel5ConohaObjectHandler\ObjectHandler;

$handler = new ObjectHandler();

Optionally, you can cache the auth token by specifying the cache key. (It is recommended. By default, the instance gets a new auth token per a request.), (*8)

use Okashoi\Laravel5ConohaObjectHandler\ObjectHandler;

// cache the auth token with key 'conoha_token'
$handler = new ObjectHandler('conoha_token');

Caching is implemented using Laravel Cache API., (*9)

Get a List of Objects

Example, (*10)

$objects = $handler->getList('container_name');

Upload an Object

Example, (*11)

$handler->upload('container_name', 'object_name.txt', '/path/to/file/to/upload.txt', 'text/plain');

Download an Object

The method download() will return GuzzleHttp response., (*12)

You can access the file content by getBody() method., (*13)

$response = $handler->download('container_name', 'object_name.txt');

echo $response->getBody();

Or you can make download response as follows., (*14)

$response = $handler->download('container_name', 'object_name.txt');

return reponse($response->getBody())->header('Content-Type', $response->getHeader('Content-Type'));

Delete an Object

Example, (*15)

$handler->delete('container_name', 'object_name.txt');

The Versions

19/12 2016

dev-master

9999999-dev

An object handler for the Conoha Object Storage on Laravel 5.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Okada Shohei

laravel laravel5 conoha

30/11 2016

v1.0

1.0.0.0

An object handler for the Conoha Object Storage on Laravel 5.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Okada Shohei

laravel laravel5 conoha