Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
An API-wrapper for Librato.
branch: master
Failed to load latest commit information.
examples new example file: delete all annotations
library/Services Allow setting set 'description'.
tests Allow setting set 'description'.
.gitignore Ignore phar.
composer.json Tabstospaces.
composer.lock Add autoload definition.
phpunit.xml fix test inclusion


This is a work in progress where we implement the Librato API as we move forward.

Current work in progress: Services\Librato\Metrics:

  • delete metrics
  • publish metrics
  • get metrics


The most interesting bit is publishing metrics. Currently, you can public an individual metric, or multiple.

A metric is created with the following code:

use Services\Librato\Metrics\Metric;
$metric         = new Metric('counter);
$metric->value  = 1;
$metric->source = 'production'; // this is optional

By default my code assumes 'gauges', so in order to send a counter, you'll have to do the following:

use Services\Librato\Metrics;
use Services\Librato\Metrics\Counters;
// create metric

$counters = new Counters();

$metrics = new Metrics('youremail', 'yourapikey');
var_dump($metrics->update($counters)); // should output 'true'

If you'd like to mix counters and gauges and submit them in one request (preferrable :)) use a SuperCollection:

use Services\Librato\Metrics;
use Services\Librato\Metrics\Counters;
use Services\Librato\Metrics\Gauges;
use Services\Librato\Metrics\SuperCollection;

// create metrics
$counters = new Counters;

$gauges = new Gauges;

$collection = new SuperCollection;

$metrics = new Metrics('youremail', 'yourapikey');
var_dump($metrics->update($counters)); // should output 'true'

For more, check out the examples directory!


One can also create and retrieve annotations. Here is an example:

use Services\Librato\Annotations;
$annotations = new Annotations($user, $apiKey);
$annotations->create('streamName', 'title', 'source', 'desc', time() - 60, time() - 5);


New BSD License.

Something went wrong with that request. Please try again.