arnovr/client-content-statistics

This package is abandoned and no longer maintained. No replacement package was suggested.

Library for using content statistics microservice

v0.0.4 2015-07-26 07:52 UTC

This package is not auto-updated.

Last update: 2015-12-05 18:21:27 UTC


README

Build Status

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();