Download the PHP package jarir-ahmed/server-stats without Composer
On this page you can find all versions of the php package jarir-ahmed/server-stats. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jarir-ahmed/server-stats
More information about jarir-ahmed/server-stats
Files in jarir-ahmed/server-stats
Package server-stats
Short Description A simple server stats package: counters, gauges, timers and system metrics over MySQL or SQLite.
License MIT
Informations about the package server-stats
server-stats
A small PHP metrics library: counters, gauges, timers, and system metrics, stored in MySQL (with automatic SQLite fallback). No external services required.
Requirements
- PHP >= 8.0
ext-pdo,ext-jsonext-pdo_mysql(optional — falls back to SQLite if MySQL is unavailable)
Install
Quick start
Configuration
Storage reads, in order: the $config array → SERVER_STATS_* environment variables → defaults.
Equivalent env vars: SERVER_STATS_HOST, SERVER_STATS_PORT, SERVER_STATS_DATABASE,
SERVER_STATS_USERNAME, SERVER_STATS_PASSWORD, SERVER_STATS_CHARSET,
SERVER_STATS_SQLITE_PATH, SERVER_STATS_RETENTION_SECONDS.
Labels
Counters, gauges and timers accept labels. For counters, labels are part of the identity (order-independent), so each label set is tracked separately.
Querying
Without global state
Use Registry directly instead of the static Metrics facade — handy for multiple backends
or test isolation:
InMemoryStorage implements the same StorageInterface and persists nothing — ideal for tests.
Architecture
StorageInterface— backend contract.Storage— PDO backend (MySQL + SQLite). Two tables:metrics(time series) andcounters(atomic aggregate state).InMemoryStorage— non-persistent backend.Registry— instance API;Metrics— static facade over a default registry.Counter,Gauge,Timer,MetricCollector.
Testing
The suite runs against InMemoryStorage and the SQLite backend. Set SERVER_STATS_TEST_MYSQL=1
(with MySQL connection env vars) to additionally run the MySQL contract tests.
License
MIT
All versions of server-stats with dependencies
ext-pdo Version *
ext-json Version *