PHPackages                             liuggio/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. liuggio/statsd-php-client

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

liuggio/statsd-php-client
=========================

Statsd (Object Oriented) client library for PHP

v1.0.18(10y ago)1153.9M—1.3%31[8 PRs](https://github.com/liuggio/statsd-php-client/pulls)8MITPHPPHP &gt;=5.3.2

Since Oct 31Pushed 2y ago10 watchersCompare

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

READMEChangelog (7)Dependencies (2)Versions (24)Used By (8)

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

[](#statsd-php-client)

[![Build Status](https://camo.githubusercontent.com/aaa0ea0b27cdff2eec76e955c27a3b7dda3412efc91b70bf691ea74086572a88/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f6c69756767696f2f7374617473642d7068702d636c69656e742e706e67)](http://travis-ci.org/liuggio/statsd-php-client) [![Latest Stable Version](https://camo.githubusercontent.com/081ecb64e559d2612155b8d93f36fbcc0a11dedb0943c7d89a237528089af551/68747470733a2f2f706f7365722e707567782e6f72672f6c69756767696f2f7374617473642d7068702d636c69656e742f762f737461626c652e706e67)](https://packagist.org/packages/liuggio/statsd-php-client) [![Total Downloads](https://camo.githubusercontent.com/2571a8a4f5f776562284056dacded4193a94ab36abfe858452347219e550c921/68747470733a2f2f706f7365722e707567782e6f72672f6c69756767696f2f7374617473642d7068702d636c69656e742f646f776e6c6f6164732e706e67)](https://packagist.org/packages/liuggio/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 liuggio/statsd-php-client
```

### Simple Usage

[](#simple-usage)

```
$statsd = new StatsdService();

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

$service->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');
$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 maintained by David Moreau AKA @dav-m85 and @liuggio

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity59

Moderate usage in the ecosystem

Community34

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 66.7% 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 ~196 days

Recently: every ~711 days

Total

20

Last Release

1218d 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.1.x-devPHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/446a646f719434553ab25f0f931d28ec09fbb036528126ac7e9d54a2e8132581?d=identicon)[liuggio](/maintainers/liuggio)

---

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 (7 commits)")[![tristanbes](https://avatars.githubusercontent.com/u/346010?v=4)](https://github.com/tristanbes "tristanbes (2 commits)")[![legoktm](https://avatars.githubusercontent.com/u/81392?v=4)](https://github.com/legoktm "legoktm (2 commits)")[![adrienbrault](https://avatars.githubusercontent.com/u/611271?v=4)](https://github.com/adrienbrault "adrienbrault (2 commits)")[![nortron](https://avatars.githubusercontent.com/u/1393314?v=4)](https://github.com/nortron "nortron (2 commits)")[![tgr](https://avatars.githubusercontent.com/u/145412?v=4)](https://github.com/tgr "tgr (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)")[![pborreli](https://avatars.githubusercontent.com/u/77759?v=4)](https://github.com/pborreli "pborreli (1 commits)")[![pgodel](https://avatars.githubusercontent.com/u/18968?v=4)](https://github.com/pgodel "pgodel (1 commits)")[![edast](https://avatars.githubusercontent.com/u/618221?v=4)](https://github.com/edast "edast (1 commits)")[![Jason-Cooke](https://avatars.githubusercontent.com/u/5185660?v=4)](https://github.com/Jason-Cooke "Jason-Cooke (1 commits)")[![Seldaek](https://avatars.githubusercontent.com/u/183678?v=4)](https://github.com/Seldaek "Seldaek (1 commits)")

---

Tags

phpmonitoringstatsdetsy

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[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)
