Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Prometheus Client Php Laravel Package

promphp/prometheus_client_php

Prometheus client library for PHP with Redis or APCu-based aggregation (plus in-memory adapter). Register and update counters, gauges, histograms, and summaries via CollectorRegistry, then expose metrics in Prometheus text format for scraping.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Observability Roadmap: Enables standardized metrics collection for PHP applications, aligning with a broader observability strategy (e.g., integrating with Prometheus/Grafana for monitoring, logging, and tracing).

  • Build vs. Buy: Buy—avoids reinventing Prometheus instrumentation from scratch, reducing dev effort while ensuring compatibility with industry-standard tools.

  • Use Cases:

    • Performance Monitoring: Track request latency, error rates, and throughput (e.g., histograms for HTTP response times).
    • Resource Utilization: Monitor memory, CPU, or queue lengths (e.g., gauges for cache hit ratios).
    • Feature Flags & A/B Testing: Instrument user interactions (e.g., counters for feature usage).
    • Microservices: Decouple metrics collection from storage (Redis/APCu adapters support distributed environments).
    • Compliance/Reporting: Export metrics to Prometheus for audits or SLO tracking.
  • Tech Stack Alignment: Ideal for PHP-based systems (Laravel, Symfony) already using Prometheus for other services (e.g., Kubernetes, Go services).


When to Consider This Package

  • Adopt if:

    • Your PHP app needs standardized metrics for Prometheus (e.g., replacing custom logging or homegrown solutions).
    • You require multi-process support (Redis/APCu adapters handle worker isolation).
    • Your team uses Prometheus/Grafana for visualization (avoids vendor lock-in).
    • You need low-latency metrics (in-memory or APCu adapters for simple setups).
  • Look elsewhere if:

    • You need PushGateway support (use the companion promphp/prometheus_push_gateway_php).
    • Your app is serverless (consider AWS CloudWatch or Datadog PHP agents).
    • You require advanced sampling (e.g., probabilistic counters; explore OpenTelemetry PHP).
    • Your infrastructure lacks Redis/APCu (in-memory adapter is limited to single-process apps).

How to Pitch It (Stakeholders)

For Executives:

"This package lets us instrument our PHP services with Prometheus metrics—standardizing how we monitor performance, errors, and usage. It’s a lightweight, battle-tested solution that integrates seamlessly with our existing Grafana dashboards, reducing toil for DevOps while enabling data-driven decisions. For example, we can track API latency spikes or feature adoption in real time, just like our Go/K8s services. The cost? Minimal—just a Redis instance for distributed setups, or zero if we use APCu."

For Engineers:

*"This is the de facto Prometheus client for PHP. It’s:

  • Flexible: Supports Redis (distributed), APCu (shared-memory), or in-memory (simple) storage.
  • Performant: Optimized for high-throughput apps (e.g., lock-free updates in APCu).
  • Extensible: Covers counters, gauges, histograms, and summaries—everything you need for SLOs.
  • Future-proof: Actively maintained (PHP 8.2+), with Predis/PDO support for edge cases.

Trade-offs:

  • No PushGateway (use the companion package if needed).
  • Redis dependency for distributed setups (but we can start with APCu for MVP).

Next steps:

  1. Add to composer.json and configure a /metrics endpoint.
  2. Instrument 2–3 critical paths (e.g., API latency, job queue depth).
  3. Visualize in Grafana using existing Prometheus queries.

Let’s prototype this in [Project X] by [date]—it’s a drop-in replacement for our ad-hoc logging."*

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport