livetyping/hermitage-php-client

Client for Hermitage servers

v0.1.1 2016-05-30 17:18 UTC

This package is not auto-updated.

Last update: 2024-11-15 22:53:00 UTC


README

PHP Client for Hermitage.

Installation

Run the Composer command to install the latest version:

composer require livetyping/hermitage-php-client ~0.1

Usage

<?php

use livetyping\hermitage\client\Client;
use livetyping\hermitage\client\RequestSigner;
use livetyping\hermitage\client\Signer;

$secret = '<secret value>';
$baseUri = 'http://hermitage';

$signer = new RequestSigner(new Signer($secret));
$client = new Client($signer, new \GuzzleHttp\Client(), $baseUri);

/** @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

Hermitage PHP Client is licensed under the MIT License.

See the LICENSE file for more information.