PHPackages                             adgoal/statsd-php-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. adgoal/statsd-php-client

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

adgoal/statsd-php-client
========================

Statsd (Object Oriented) client library for PHP

v1.1(6y ago)04.0k2MITPHPPHP &gt;=5.6

Since Oct 31Pushed 6y agoCompare

[ Source](https://github.com/Adgoal/statsd-php-client)[ Packagist](https://packagist.org/packages/adgoal/statsd-php-client)[ Docs](https://github.com/liuggio/statsd-php-client/)[ RSS](/packages/adgoal-statsd-php-client/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (3)Versions (24)Used By (2)

statsd-php-client
-----------------

[](#statsd-php-client)

[![Build Status](https://camo.githubusercontent.com/de23e8b9f72faa82da1b6cae7f2ce16796e560f609e8a7384cd0086270d3b304/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f6164676f616c2f7374617473642d7068702d636c69656e742e706e67)](http://travis-ci.org/adgoal/statsd-php-client)[![Latest Stable Version](https://camo.githubusercontent.com/a01e508dba7d1a36ca991c4a7cd5391fae319e0f2e226e88f559d5a5b9dcffa6/68747470733a2f2f706f7365722e707567782e6f72672f6164676f616c2f7374617473642d7068702d636c69656e742f762f737461626c652e706e67)](https://packagist.org/packages/adgoal/statsd-php-client)[![Total Downloads](https://camo.githubusercontent.com/6fd0b18338ebd881a0aa115ea6c763164f677d1278993d19feb44cf6700c0f96/68747470733a2f2f706f7365722e707567782e6f72672f6164676f616c2f7374617473642d7068702d636c69656e742f646f776e6c6f6164732e706e67)](https://packagist.org/packages/adgoal/statsd-php-client)[![Coverage Status](https://camo.githubusercontent.com/150d93fbbc231acb117b7230ab098335518a40477d366200a1a3b5599f214ba4/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f4164676f616c2f7374617473642d7068702d636c69656e742f62616467652e737667)](https://coveralls.io/github/Adgoal/statsd-php-client)

`statsd-php-client` is an Open Source, and **Object Oriented** Client for **etsy/statsd** written in php

### Install with composer

[](#install-with-composer)

```
composer require adgoal/statsd-php-client
```

### Simple Usage

[](#simple-usage)

```
use Liuggio\StatsdClient\Service\StatsdService;

$statsd = new StatsdService();

$statsd->timing('usageTime', 100);
$statsd->increment('visitor');
$statsd->decrement('click');
$statsd->gauge('gaugor', 333);
$statsd->set('uniques', 765);

$statsd->flush();
```

Why use this library instead the [statsd/php-example](https://github.com/etsy/statsd/blob/master/examples/php-example.php)?
---------------------------------------------------------------------------------------------------------------------------

[](#why-use-this-library-instead-the-statsdphp-example)

- You are wise.
- You could also use monolog to redirect data to statsd
- This library is tested.
- This library optimizes the messages to send, compressing multiple messages in individual UDP packets.
- This library pays attention to the maximum length of the UDP.
- This library is made by Objects not array, but it also accepts array.
- You do want to debug the packets, and using `SysLogSender` the packets will be logged in your `syslog` log (on debian-like distro: `tail -f /var/log/syslog`)

### Advanced Instantiation

[](#advanced-instantiation)

```
use Liuggio\StatsdClient\StatsdClient,
    Liuggio\StatsdClient\Factory\StatsdDataFactory,
    Liuggio\StatsdClient\Sender\SocketSender,
    Liuggio\StatsdClient\Service\StatsdService;
// use Liuggio\StatsdClient\Sender\SysLogSender;

$sender = new SocketSender(/*'localhost', 8126, 'udp'*/);
// $sender = new SysLogSender(); // enabling this, the packet will not send over the socket

$client  = new StatsdClient($sender);
$factory = new StatsdDataFactory(Liuggio\StatsdClient\Entity\StatsdData::class);
$service = new StatsdService($client, $factory);

// create the metrics with the service
$service->timing('usageTime', 100);

//...

// send the data to statsd
$service->flush();
```

### Usage with Monolog

[](#usage-with-monolog)

```
use Liuggio\StatsdClient\StatsdClient,
    Liuggio\StatsdClient\Factory\StatsdDataFactory,
    Liuggio\StatsdClient\Sender\SocketSender;
// use Liuggio\StatsdClient\Sender\SysLogSender;

use Monolog\Logger;
use Liuggio\StatsdClient\Monolog\Handler\StatsDHandler;

$sender = new SocketSender(/*'localhost', 8126, 'udp'*/);
// $sender = new SysLogSender(); // enabling this, the packet will not send over the socket
$client = new StatsdClient($sender);
$factory = new StatsdDataFactory();

$logger = new Logger('my_logger');
$logger->pushHandler(new StatsDHandler($client, $factory, 'prefix', Logger::DEBUG));

$logger->addInfo('My logger is now ready');
```

the output will be: `prefix.my_logger.INFO.My-logger:1|c" 36 Bytes`

Short Theory
------------

[](#short-theory)

### Easily Install StatSD and Graphite

[](#easily-install-statsd-and-graphite)

In order to try this application monitor you have to install etsy/statsd and Graphite

see this blog post to install it with vagrant [Easy install statsd graphite](http://welcometothebundle.com/easily-install-statsd-and-graphite-with-vagrant/).

#### [StatsD](https://github.com/etsy/statsd)

[](#statsd)

StatsD is a simple daemon for easy stats aggregation

#### [Graphite](http://graphite.wikidot.com/)

[](#graphite)

Graphite is a Scalable Realtime Graphing

#### The Client sends data with UDP (faster)

[](#the-client-sends-data-with-udp-faster)

Contribution
------------

[](#contribution)

Active contribution and patches are very welcome. To keep things in shape we have quite a bunch of unit tests. If you're submitting pull requests please make sure that they are still passing and if you add functionality please take a look at the coverage as well it should be pretty high :)

- First fork or clone the repository

```
git clone git://github.com/liuggio/statsd-php-client.git
cd statsd-php-client

```

- Install vendors:

```
composer.phar install
```

- This will give you proper results:

```
phpunit --coverage-html reports
```

Core developers:
----------------

[](#core-developers)

This project is actively mantained by David Moreau AKA @dav-m85 and @liuggio

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 66% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~127 days

Recently: every ~382 days

Total

20

Last Release

2529d ago

Major Versions

v1.0.11 → 2.0.x-dev2013-12-18

PHP version history (3 changes)v1.0.0-RC1PHP &gt;=5.2

v1.0.14PHP &gt;=5.3.2

v1.1PHP &gt;=5.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/f4d59ea4bdf00e8a2b7ac18da994d769a06136ca1cfdf9e17306e235901cac31?d=identicon)[wir\_wolf](/maintainers/wir_wolf)

---

Top Contributors

[![liuggio](https://avatars.githubusercontent.com/u/530406?v=4)](https://github.com/liuggio "liuggio (70 commits)")[![20uf](https://avatars.githubusercontent.com/u/3873958?v=4)](https://github.com/20uf "20uf (12 commits)")[![dav-m85](https://avatars.githubusercontent.com/u/1519726?v=4)](https://github.com/dav-m85 "dav-m85 (6 commits)")[![wirwolf](https://avatars.githubusercontent.com/u/8457572?v=4)](https://github.com/wirwolf "wirwolf (3 commits)")[![nortron](https://avatars.githubusercontent.com/u/1393314?v=4)](https://github.com/nortron "nortron (2 commits)")[![legoktm](https://avatars.githubusercontent.com/u/81392?v=4)](https://github.com/legoktm "legoktm (2 commits)")[![tristanbes](https://avatars.githubusercontent.com/u/346010?v=4)](https://github.com/tristanbes "tristanbes (2 commits)")[![adrienbrault](https://avatars.githubusercontent.com/u/611271?v=4)](https://github.com/adrienbrault "adrienbrault (2 commits)")[![pgodel](https://avatars.githubusercontent.com/u/18968?v=4)](https://github.com/pgodel "pgodel (1 commits)")[![Seldaek](https://avatars.githubusercontent.com/u/183678?v=4)](https://github.com/Seldaek "Seldaek (1 commits)")[![tgr](https://avatars.githubusercontent.com/u/145412?v=4)](https://github.com/tgr "tgr (1 commits)")[![pborreli](https://avatars.githubusercontent.com/u/77759?v=4)](https://github.com/pborreli "pborreli (1 commits)")[![derek9gag](https://avatars.githubusercontent.com/u/14237112?v=4)](https://github.com/derek9gag "derek9gag (1 commits)")[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (1 commits)")[![edast](https://avatars.githubusercontent.com/u/618221?v=4)](https://github.com/edast "edast (1 commits)")

---

Tags

phpmonitoringstatsdetsy

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/adgoal-statsd-php-client/health.svg)

```
[![Health](https://phpackages.com/badges/adgoal-statsd-php-client/health.svg)](https://phpackages.com/packages/adgoal-statsd-php-client)
```

###  Alternatives

[liuggio/statsd-php-client

Statsd (Object Oriented) client library for PHP

1153.9M9](/packages/liuggio-statsd-php-client)[ptrofimov/beanstalk_console

Admin console for Beanstalk queue server

1.3k124.7k](/packages/ptrofimov-beanstalk-console)[slickdeals/statsd

a PHP client for statsd

264.5M8](/packages/slickdeals-statsd)[inspector-apm/inspector-php

Inspector monitoring for PHP applications.

342.4M15](/packages/inspector-apm-inspector-php)[bacula-web/bacula-web

The open source web based reporting and monitoring tool for Bacula

1537.5k](/packages/bacula-web-bacula-web)[inspector-apm/inspector-symfony

Code Execution Monitoring for Symfony applications.

2830.1k2](/packages/inspector-apm-inspector-symfony)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
