PHPackages                             stevenscg/statsd-php - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. stevenscg/statsd-php

ActiveLibrary[HTTP &amp; Networking](/categories/http)

stevenscg/statsd-php
====================

Sends statistics to a statsd daemon over UDP

v1.0.0(8y ago)58.4k↑80%1MITPHPPHP ^7.0

Since Sep 22Pushed 8y ago1 watchersCompare

[ Source](https://github.com/stevenscg/statsd-php)[ Packagist](https://packagist.org/packages/stevenscg/statsd-php)[ RSS](/packages/stevenscg-statsd-php/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)DependenciesVersions (2)Used By (0)

PHP Class for StatsD
====================

[](#php-class-for-statsd)

Send statistics to the statsd daemon over UDP.

This class generally follows the official php-example from Etsy, but moves the configuration options into the main class with reasonable defaults. This should make incorporation into framework-based applications more straightforward.

Installation
------------

[](#installation)

Installation is via composer:

```
composer require stevenscg/statsd-php

```

Configuration
-------------

[](#configuration)

The library can be configured by calling `StatsD::config($params)`.

`$params` is an array that supports the following keys:

`enabled` - boolean - Set to false to disable UDP transmission (default: true)

`prefix` - string - Apply a global namespace to all metrics from this application

`host` - string - Hostname or IP of your carbon/graphite server

`port` - integer - StatsD port of your carbon/graphite server

The library can also be configured via environment variables:

`STATSD_ENABLED` - A boolean-like string (i.e. true, false, 1, 0)

`STATSD_PREFIX` - string

`STATSD_ADDR` - string - Example: 127.0.0.1:8125

StatsD Data Types and Class Methods
-----------------------------------

[](#statsd-data-types-and-class-methods)

- Counting - `increment` and `decrement`
- Timing - `timing`
- Sampling - supported via "sampleRate" parameter on `increment` and `decrement`
- Gauges - `gauge`
- Sets - `set`

Usage
-----

[](#usage)

All methods are declared as static as they were in the upstream project.

Incrementing a counter is as simple as:

```
StatsD::increment("api.requests");

```

Example: Tracking logins and failures

```
function login() {
  ...
  if (!$this->Auth->login()) {
    StatsD::increment("logins.failed");
    return;
  }
  StatsD::increment("logins.ok");
  ...
}

```

License
-------

[](#license)

MIT

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

3206d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f9a2c2583c960d8e768345751800fe2fc22a259e6c84825551d95d3a369ba179?d=identicon)[stevenscg](/maintainers/stevenscg)

---

Top Contributors

[![stevenscg](https://avatars.githubusercontent.com/u/176253?v=4)](https://github.com/stevenscg "stevenscg (15 commits)")

### Embed Badge

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

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

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25126.1M82](/packages/php-http-cache-plugin)[illuminate/http

The Illuminate Http package.

11937.9M6.9k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k24.3k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

87965.9k114](/packages/httpsoft-http-message)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.4M92](/packages/mezzio-mezzio-router)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69127.2k](/packages/serpapi-google-search-results-php)

PHPackages © 2026

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