intaro/pinba-bundle
Symfony bundle integrating the Pinba PHP extension for real-time application monitoring and profiling. Collect timers, tags, and custom metrics, then send them to Pinba for performance analysis and bottleneck detection.
Architecture fit. The first thing to flag: intaro/pinba-bundle is a Symfony bundle, not a Laravel package. It ships a Bundle class, DI compiler passes, and Doctrine/Twig/Memcache event subscribers — none of which have a direct analogue in Laravel's service provider / middleware / facade model. The underlying mechanism, however, is framework-agnostic: the pinba PECL extension exposes procedural functions (pinba_timer_start, pinba_timer_stop, pinba_script_name_set, pinba_flush) that any PHP runtime can call. So the bundle is best evaluated as a reference implementation for how to instrument a PHP framework, not as something we install into a Laravel app.
Integration feasibility. Moderate effort, low conceptual risk. A Laravel integration would be a thin package of our own:
pinba_script_name_set() and registers global middleware for request-level timers.DB::listen).The bundle's own source is small and readable, so we can crib the timer lifecycle and tag conventions rather than reinvent them.
Technical risk. This is the dominant concern, and it's mostly upstream of the bundle:
pinba2/pinba_server) is the realistic target. Either way, we'd be operating a niche, low-activity daemon.pecl/pinba has lagged PHP major versions; PHP 8.x support depends on forks/patches. This is a hard blocker if our fleet is on PHP 8.2+ without a maintained build.composer.json and tag history before trusting the release cadence claim.Key questions.
pinba extension?Stack fit. Poor as a drop-in, acceptable as a pattern. Laravel's request lifecycle, container, and event model differ enough that a Symfony bundle cannot be consumed. The realistic shape is a small first-party Laravel package (~300–500 LOC) that uses the pinba extension directly and borrows this bundle's timer naming and tagging conventions. That keeps us on supported Laravel idioms while preserving the operational semantics the bundle encodes.
Migration path. There is nothing to migrate from in a Laravel context, so this is greenfield:
DB::listen hook, flush-on-terminate).Compatibility. Two axes:
composer.json constraints (symfony/* versions) are irrelevant to us.Sequencing.
Maintenance. We would own: the Laravel shim (small, ours), the PECL extension build (moderate — must rebuild per PHP upgrade, and PHP upgrades now carry an extra gate), and the Pinba/Pinba2 server + MySQL storage (real infra). The upstream bundle is not something we maintain, but it is also not something we can lean on for fixes. Budget roughly a one-time 3–4 week investment plus recurring cost at every PHP major upgrade.
Support. No SLA, no vendor, 22 stars, zero dependents — effectively no community to escalate to. Internal ownership is mandatory from day one. Document the timer tag schema and the shim's internals so knowledge doesn't concentrate in one engineer.
Scaling. Architectural limits to state plainly: Pinba ingests over UDP, so samples are lossy under load by design (acceptable for aggregate latency stats, unacceptable for auditing). Storage is MySQL-backed with bounded retention; it is a recent-window real-time view, not a long-term metrics store. It also has no meaningful cardinality control — tag explosion (e.g., per-user IDs, per-query text) will degrade the collector. Enforce a tag allowlist in the shim.
Failure modes.
function_exists() and a config gate so application boot never hard-fails.Ramp-up. Low for engineers (the API is a handful of functions), moderate for the platform team (extension builds, collector ops, retention tuning). Two to three days of onboarding should cover the shim; the collector and extension toolchain is the real learning curve.
Recommendation. Do not adopt intaro/pinba-bundle as a dependency — the Symfony/Laravel mismatch alone disqualifies it. Use it as a design reference for a time-boxed Laravel-native Pinba shim, and only proceed if the extension builds cleanly against our PHP version and we accept ownership of a Pinba2 collector. If the underlying need is aggregate latency visibility rather than sub-second per-request timers, OpenTelemetry is the lower-risk path and should be evaluated in parallel during the spike.
How can I help you explore Laravel packages today?