bureaupieper / storee-php-client
Client for the Store-E REST API
Requires
- php: >=5.5
- guzzlehttp/guzzle: ^6.1
- psr/log: ^1.0
- symfony/config: ~2.7
- symfony/dependency-injection: ~2.7
- tedivm/stash: ^0.13.1
Requires (Dev)
- monolog/monolog: ^1.17
- phpunit/phpunit: ^4
Suggests
- monolog/monolog: ^1.17
README
Store-E is a content(-as-a-service/repository) platform taking care of all your content management needs. Content is delivered through 'Hotspots' and 'Pages' which you can define. Published content comes along with every form of media, which is also delivered through-, automated and managed by Store-E. Bitmaps in multiple formats and resolutions(no restrictions), videos in H.264, MP4, OGV, documents, third party integrations, and much more.
This client enables you to connect your website, enterprise network or social media platforms to our content repository in a matter of hours.
This library supports PSR-3 logging and provides some extra functionality for Monolog. Caching is handled by Stash. HTTP abstraction is handled by Guzzle. You're free to provide your own for any of the dependencies.
Installation
Stand-alone
$ curl -sS https://getcomposer.org/installer | php
$ composer require bureaupieper/storee-client
$ ./vendor/bin/phpunit
Symfony users
See the BureauPieper/storee-php-client-bundle for easy integration!
Usage:
Create the configuration container
See the tree for all the possibilities. The container makes sure your provided options are conflict-free.
$config = new Config(['apikey' => '1234', 'platform' => 'yourplatform']);
Instantiate the client
$client = new Client($config, \GuzzleHttp\Client $client = null, AbstractDriver $cacheDriver = null, Logger $logger = null);
Create the intermediary request object, and fire away.
$req = Client\Request\Factory::create('profile'); $result = $client->request($req);
$req = Client\Request\Factory::create('content/list', [ 'hotspot' => 'my-hotspot' 'page' => 'my-page', ]); $result = $client->request($req);
Content items in a result set are wrapped by ContentResult.php to ease development.
HTTP
A plain GuzzleHttp instance is used by default, checkout Guzzle for more information.
- getlastRequest doesnt work when passing your own client, feel free to add
Bureaupieper\StoreeClientEffectiveUrlMiddleware
to your own handler stack when passing a client as following:
$stack = GuzzleHttp\HandlerStack::create(); $effectiveUrlMiddleware = new Bureaupieper\StoreeClientEffectiveUrlMiddleware(); $stack->push(GuzzleHttp\Middleware::mapRequest($effectiveUrlMiddleware)); $client = new GuzzleHttp\Client([ 'handler' => $stack ]);
Caching
Enabled by default with a filesystem driver. See Stash for a wide variety of driver options if you need to setup memcache across multiple nodes for example.
Cache will be refreshed based on the Time-to-renew(ttr) setting, TTL is irrelevant. If the endpoint goes down the platform stays up.
PSR-3 Logging
Can be enabled, if no implementation is provided Monolog will be used with two RotatingFileHandlers. Both INFO and ERR will be be saved to $config['logs']['default_driver']['path']
, but it is recommended to
pass a monolog instance with some filesystem handlers and setup logrorate yourself.
The mail setup will only work with the default logger instance.
Documentation
W.I.P
Contact
- piet@store-e.nl (tech)
- info@store-e.nl (inquiries)