PHPackages                             heapstersoft/stats-writer - 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. heapstersoft/stats-writer

ActiveLibrary

heapstersoft/stats-writer
=========================

Php Stats Writer

014PHP

Since Nov 26Pushed 13y ago1 watchersCompare

[ Source](https://github.com/p1r0/stats-writer)[ Packagist](https://packagist.org/packages/heapstersoft/stats-writer)[ RSS](/packages/heapstersoft-stats-writer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Stats
=====

[](#stats)

Intro
-----

[](#intro)

Stats is a small php project to help using stats from your current project. It supports any backend for which you want to write an adapter and it comes with one for statsd.

Installing
----------

[](#installing)

No actual installation is needed just add this to your composer.json require section:

```
	"heapstersoft/stats-writer": "1.0.x-dev"
```

Usage
-----

[](#usage)

First of all you need to include your composer autoload as with any project using composer:

```
	require 'vendor/autoload.php';
```

ideally you would do this in one central place and only once.

Then to send a stat to the backend (see configuration section) you need to create a stats object passing the config file as a first paramenter and the just use either increment or decrement:

```
	$statWriter = new \Heapstersoft\Stats\Writer('config/stats.yml');

	$statWriter->increment('key1');
```

For more information I encourage you to view the source code.

Congfiguration
--------------

[](#congfiguration)

Stats uses a simple YAML file as configuration with a mandatory "Adapter" key.

Under adapter you just neet the adapter class. The rest of the parameters ara adapter specific.

For an example configuration see the StatsD adapter section.

Adapters
--------

[](#adapters)

### StatsD

[](#statsd)

Example configuration file for StatsD:

```
	Adapter:
	  class: \Heapstersoft\Stats\Adapter\StatsD
	  host: "127.0.0.1"
	  port: 8125
	  key: "#host#.test.#key#"
```

All parameter should be self explainatory except for the "key" parameter.

Key allows you to customize the key string sent to the statsd backend. It suports any string with some special placeholders.

Right now these placeholders are: #host# that is replaced by the $\_SERVER\['HTTP\_HOST'\] variable and the #key# that is replaced for the value you pass to increment or decremant.

If no #key# is spcecified, it is appended.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

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

---

Top Contributors

[![p1r0](https://avatars.githubusercontent.com/u/134297?v=4)](https://github.com/p1r0 "p1r0 (11 commits)")

### Embed Badge

![Health badge](/badges/heapstersoft-stats-writer/health.svg)

```
[![Health](https://phpackages.com/badges/heapstersoft-stats-writer/health.svg)](https://phpackages.com/packages/heapstersoft-stats-writer)
```

PHPackages © 2026

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