livetyping / yii2-hermitage-client
Yii2 Hermitage Client Adapter
Installs: 4 980
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 6
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- php: >=5.5
- livetyping/hermitage-php-client: ~0.1
- yiisoft/yii2: ~2.0
Requires (Dev)
- phpro/grumphp: ~0.9
- squizlabs/php_codesniffer: ~2.3
This package is not auto-updated.
Last update: 2024-12-21 20:57:40 UTC
README
Yii2 Adapter for Hermitage Client.
Installation
-
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', ], // ... ],
Usage
<?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>');
License
Yii2 Hermitage Client is licensed under the MIT License.
See the LICENSE file for more information.