promphp/prometheus_client_php
Prometheus client library for PHP with counters, gauges, histograms, and summaries. Supports Redis, Predis, APCu/APCng, or in-memory storage for metric aggregation across workers, with simple APIs to register, update, and expose metrics for scraping.
variant="control").Adopt When:
prometheus_push_gateway_php if needed)./metrics) and configure storage adapters (Redis/APCu).Look Elsewhere If:
stripe/prometheus-client-php).*"This library lets us instrument our PHP applications with standardized, open-source metrics—enabling proactive performance monitoring, cost savings (vs. APM tools), and compliance reporting. By integrating Prometheus, we gain:
*"This is the de facto Prometheus client for PHP, offering:
service="auth", environment="prod").// Track API requests
$counter = CollectorRegistry::getDefault()
->getOrRegisterCounter('api', 'requests_total', 'Total API calls')
->inc();
Trade-offs: Requires manual endpoint setup (/metrics) and Redis/APCu config. No PushGateway (but we can add the companion package if needed)."*
*"This gives us self-service metrics for PHP apps without relying on external APM tools. Key benefits:
composer.json, configure Redis/APCu, and expose /metrics (e.g., via Nginx route). Example Docker setup:
services:
redis:
image: redis
app:
depends_on: [redis]
Alerting: Define rules in Prometheus (e.g., api_requests_total > 1000 triggers an alert)."*
How can I help you explore Laravel packages today?