PHP code example of livetyping / hermitage-php-client
1. Go to this page and download the library: Download livetyping/hermitage-php-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/ */
livetyping / hermitage-php-client example snippets
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>');
bash
composer