Yii2 Adapter for Hermitage Client.
-
Run the Composer command to install the latest version:
composer require livetyping/yii2-hermitage-client ~0.1
-
Add the component to
config/main.php
:'components' => [ // ... 'hermitage' => [ 'class' => 'livetyping\hermitage\client\yii2\Component', 'secret' => '<secret value>', 'baseUri' => 'http://hermitage', // 'algorithm' => 'sha256', ], // ... ],
<?php
/** @var \livetyping\hermitage\client\contracts\Client $client */
$client = Yii::$app->get('hermitage');
/** @var \Psr\Http\Message\ResponseInterface $response */
$response = $client->upload(file_get_contents('path/to/local/image'));
$filename = json_decode((string)$response->getBody());
$filename = $filename['filename'];
$response = $client->get($filename, '<version name>');
$response = $client->delete($filename);
/** @var \Psr\Http\Message\UriInterface $uri */
$uri = $client->uriFor($filename, '<version name>');
Yii2 Hermitage Client is licensed under the MIT License.
See the LICENSE file for more information.