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.0k↓50%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 1mo ago

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 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

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

3160d 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

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78026.4M414](/packages/react-http)[php-http/curl-client

PSR-18 and HTTPlug Async client with cURL

48347.0M384](/packages/php-http-curl-client)[smi2/phpclickhouse

PHP ClickHouse Client

84310.1M71](/packages/smi2-phpclickhouse)

PHPackages © 2026

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