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.
Reality check first: this is a Symfony bundle, not a Laravel package. There is no service provider, no config/app.php registration, and none of the Laravel-specific ergonomics (no auto-discovery, no facade). If you're a Laravel dev, your day-to-day use is essentially limited to (a) working inside a Symfony codebase or migrating one, or (b) borrowing its patterns while you wire the underlying elastic/apm-agent-php agent into Laravel yourself.
Minimal steps in a Symfony context:
composer require firmaprofesional/elastic-apm-bundle (and confirm the transitive elastic/apm-agent-php agent version it pulls — see Gotchas).config/bundles.php.config/packages/ with the server URL, service name, and secret token — most of these should be env-driven (ELASTIC_APM_SERVER_URL, ELASTIC_APM_SERVICE_NAME, ELASTIC_APM_SECRET_TOKEN) rather than hard-coded.Where to look first: the bundle's DependencyInjection/Configuration.php — that's the authoritative list of config keys and their defaults. Then scan EventSubscriber/ (or equivalent) to see exactly what it auto-instruments (HTTP kernel, Doctrine, console). Everything else is just the underlying agent API.
First use case: let the bundle create the HTTP transaction for a controller action, open Kibana APM, and confirm the transaction name and duration. If that works, APM is wired; everything after is span-level detail.
payment.charge, not payment.charge.user_1234).order_id, tenant) on the current transaction/span so Kibana searches are useful. Avoid dumping full payloads — they bloat the index and leak PII.artisan-style commands won't be traced automatically. Wrap the command body in a transaction and end it, or you'll see only the HTTP side of your app.trace_id) through the job payload and start a child transaction with it. This is the single most common gap.dev/test (the agent is heavy in dev and pollutes the index). Drive enabled, transaction_sample_rate, and log_level from env.elastic/apm-agent-php version explicitly so a transitive bump doesn't silently break instrumentation.elastic/apm-agent-php), which instruments any PHP app — including Laravel — without a framework bundle at all.php.ini config (elastic_apm.*), and write a small middleware to name transactions after the route ($request->route()->getName()) — otherwise every transaction is named after the path and cardinality explodes./users/1234), which shatters your transaction list. Normalize early.log_level=debug), confirm extension_loaded('elastic_apm') if you're on the extension, and verify the secret token/server URL with a curl. The bundle won't surface these errors for you.transaction_sample_rate in prod before you roll out broadly.log_level: debug in the agent, not the bundle. The bundle's own logging is thin.How can I help you explore Laravel packages today?