firmaprofesional/elastic-apm-bundle
A Symfony bundle that integrates Elastic APM with PHP applications, making it easy to instrument requests, console commands, and services. Capture transactions, spans, errors, and performance metrics with minimal configuration and send telemetry to your Elastic APM server.
Architecture fit. Despite being filed under a Laravel/PHP search, firmaprofesional/elastic-apm-bundle is a Symfony bundle, not a Laravel package. Its value proposition rests on three Symfony-specific extension points: the Bundle class registered in config/bundles.php, a DependencyInjection\Extension that builds a configuration tree, and event subscribers bound to kernel.request / kernel.response / kernel.exception. Laravel has no equivalent bundle registry — integration would mean re-implementing that wiring as a service provider, HTTP middleware, and a terminate callback. The only reusable asset is the package's APM Server payload assembly (transactions, spans, errors) against the intake API. So architecture fit against a Laravel codebase is low: it is a reference implementation, not a dependency.
Integration feasibility. Feasible in three shapes, in descending order of preference:
| Option | What it means | Effort (TPM estimate) |
|---|---|---|
| Official Elastic PHP agent | elastic/apm-agent-php extension + OTLP or intake; auto-instrumentation, no Laravel coupling |
1–2 days spike, ops-managed extension install |
| OpenTelemetry PHP → APM Server | OTel SDK + OTLP exporter; Elastic accepts OTLP natively; vendor-neutral | 1–2 weeks for meaningful coverage |
| Port this bundle's client | Extract payload/transport logic into a Laravel package (middleware + provider + config) | 3–4 weeks incl. tests, then permanent fork ownership |
Direct composer require into a Laravel app is not a viable path.
Technical risk: high. Last release 2020-06-16, zero stars, zero dependents, score 0. Concretely: it predates PHP 8.x and modern Symfony majors, so its version constraints will likely conflict with a current Laravel composer.json; it has no visible field validation (0 dependents = no production evidence); it is unmaintained, so no security response path; and the APM Server intake schema has drifted since 2020, meaning payloads may be rejected or silently degraded by a modern APM Server. Bundling an abandoned dependency into the platform also creates Dependabot noise, audit findings, and a fork obligation we would own indefinitely.
Key questions for the requester:
apm-agent-php) in our runtime image, or are we restricted to userland dependencies? Extension install removes the need for this bundle entirely.Stack fit. Treat the bundle as a design reference, not a runtime component. Read its transaction/span payload construction and its error-capture semantics, then implement a thin Laravel-native adapter if a first-party agent is unavailable: ApmServiceProvider (config publish + singleton client), ApmRequestMiddleware (start transaction, tag route/controller/user), and a terminable middleware to close and flush after the response is sent. Target Laravel 10/11, PHP 8.2/8.3, and pin to the APM Server intake version we actually run.
Migration path. Recommended sequence: (1) two-day spike comparing official agent vs. OTel against a staging Laravel app; (2) if the official agent works, adopt it and close this package out; (3) only if both are blocked, build the internal adapter, optionally crediting the bundle's payload code under its license in a vendored, tested fork; (4) never leave the bundle as a transitive dependency of the app.
Compatibility. Assume the bundle requires Symfony 4/5-era components and PHP 7.x. Validate with a disposable composer require --dry-run in a throwaway Laravel skeleton before any design commitment — a version-conflict result is the cleanest possible kill signal and costs minutes.
Sequencing. Requirements and vendor decision → spike → instrumentation of one service (breadth of routes, not depth) → sampling and cost tuning → rollout to remaining services. Do not instrument everything before confirming the APM Server ingests our payloads correctly.
Maintenance. As-is: unacceptable. An unmaintained, zero-adoption dependency becomes our fork the moment we patch it for PHP 8 or an intake schema change, with no upstream to rebase against. The ownership transfer from "community package" to "internal team" is the real cost, and it is permanent and unbudgeted.
Support. No upstream maintainer, no issue triage, no CVE response. Any incident traced to APM instrumentation has no escalation path — that is a support-tier commitment we would have to staff internally, likely above what an observability sidecar deserves.
Scaling. Instrumentation cost is per-request: transaction/span assembly and JSON serialization on the hot path, plus buffered flush. Mitigate with head-based sampling, route allow/deny lists, and asynchronous flush after response termination. APM Server capacity and storage retention must be sized for the sampled volume, not raw request rate. The bundle's 2020 buffering model is unlikely to align with current PHP-FPM worker recycling behavior — expect to tune or replace it.
Failure modes. The critical one: APM Server unreachable or slow must fail open. Instrumentation can never add latency or 5xx to application traffic — enforce short connect timeouts, bounded buffer with drop-oldest, and a circuit breaker. Secondary modes: silent payload rejection after an APM Server upgrade (schema drift, detected only by absent dashboards), memory growth from unflushed spans in long-running workers, and dropped spans on fatal errors if flush is bound to graceful termination only. Each needs an explicit test in staging, not a hope.
Ramp-up. Team needs Elastic APM/Kibana APM UI literacy, intake API schema familiarity, and sampling intuition — roughly one engineer-week for a working baseline. If we take the OTel route, that investment transfers to a transferable skill rather than to a dead bundle. That asymmetry is the strongest argument in this whole assessment: spend the ramp-up on a maintained standard, and retire this package from the candidate list.
How can I help you explore Laravel packages today?