A PHP library providing a consistent functional API to abstract various metrics collection backends and prevent vendor lock-in.
Metrics is a PHP library that abstracts different metrics collection backends behind a consistent, functional API. It solves the problem of vendor lock-in by allowing developers to instrument their application once and switch between monitoring systems like StatsD, Prometheus, or InfluxDB without code changes. The library provides simple methods for incrementing counters, recording timings, and measuring values, unifying interaction with various collectors.
PHP developers and teams who need to instrument applications for monitoring and want to avoid being tied to a specific metrics backend. It's particularly useful for projects using Symfony, as it includes a dedicated bundle.
Developers choose Metrics for its simplicity and vendor neutrality—it offers a single, clean API that works across many popular monitoring backends, reducing integration complexity and future migration costs.
Simple library that abstracts different metrics collectors. I find this necessary to have a consistent and simple metrics (functional) API that doesn't cause vendor lock-in.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Abstracts over ten different collectors including StatsD, Prometheus, and InfluxDB, allowing developers to switch backends without code changes, as highlighted in the README's supported backends list.
Provides consistent methods like increment(), decrement(), timing(), and measure() across all backends, making instrumentation straightforward and reducing learning curve.
Ships with a ready-to-use Symfony Bundle for easy configuration and service injection, demonstrated in the README with YAML configuration examples.
Includes a flush() method for backends that aggregate metrics, enabling efficient batch sending to reduce network overhead, as noted in the API section.
The library only sends metrics to backends and explicitly states it's not for displaying metrics, requiring additional tools for dashboards and analysis.
Supports basic counters, timings, and measurements but lacks advanced types like histograms or distributions, which might be needed for detailed observability.
While it works with any PHP project, optimal integration is via the Symfony Bundle; other frameworks like Laravel require manual setup, adding complexity.