arnovr / client-content-statistics
Library for using content statistics microservice
Installs: 191
Dependents: 0
Suggesters: 0
Security: 0
Open Issues: 1
pkg:composer/arnovr/client-content-statistics
Requires
- php: >=5.4.0
- guzzlehttp/guzzle: ~5.0
Requires (Dev)
- mockery/mockery: ^0.9.4
- phpunit/phpunit: ^4.6
This package is not auto-updated.
Last update: 2015-12-05 18:21:27 UTC
README
This is a library for service-content-statistics microservice.
Usage
use Arnovr\Statistics\ContentStatisticsClient;
use Arnovr\Statistics\Api\ApiConnection;
use Arnovr\Statistics\Streams\ActivityStream;
use Arnovr\Statistics\Streams\StorageStream;
$apiConnection = new ApiConnection(
new \GuzzleHttp\Client(),
'http://localhost',
'test',
'password'
);
$contentStatisticsClient = new ContentStatisticsClient(
new ActivityStream($apiConnection),
new StorageStream($apiConnection)
);
Add Activity
use Arnovr\Statistics\Streams\Activity\Activity;
$activity = new Activity('test1', 'file:write');
$contentStatisticsClient->commit($activity);
Add Storage
use Arnovr\Statistics\Streams\Storage\Storage; $storage = new Storage(1024, 'test1', 1024 * 1024); $contentStatisticsClient->commit($storage);
Pushing it to the server
When all activities or storages are committed to the client, you can push them all at once to the server
$contentStatisticsClient->push();