Weave 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
Elastic Apm Bundle

Elastic Apm Bundle Laravel Package

spacespell/elastic-apm-bundle

Symfony bundle for integrating Elastic APM into PHP apps, with request tracing, transactions, spans, error capture, and performance monitoring. Sends APM data to Elasticsearch/Kibana with minimal configuration for better observability.

View on GitHub
Deep Wiki
Context7

spacespell/elastic-apm-bundle brings Elastic APM observability to your Laravel or plain PHP application with almost no configuration. It hooks into the request lifecycle to record transactions and spans automatically, so requests, queries, and background jobs show up as rich, searchable traces in the Elastic APM UI — no manual instrumentation spread across your codebase.

  • Automatic transaction and span collection for HTTP requests
  • Built-in tracing for database queries and HTTP client calls
  • Queue job and console command monitoring
  • Exception capture with full stack context
  • Configurable sampling rate, service name, and environment
Frequently asked questions about Elastic Apm Bundle
Does spacespell/elastic-apm-bundle work with Laravel?
It is a Symfony bundle rather than a Laravel package, even though it is often catalogued alongside Laravel libraries. It hooks into the Symfony HTTP kernel, event dispatcher, Doctrine and Twig, so its auto-instrumentation does not map onto Laravel middleware, service providers, queues or Artisan commands. For a Laravel application the practical path is the official Elastic APM PHP agent with a thin middleware or service provider, or OpenTelemetry. Treat this bundle as a reference implementation rather than a drop-in Laravel integration.
How do I install elastic-apm-bundle with Composer?
Require it with composer require spacespell/elastic-apm-bundle in a Symfony 4 or 5 application running PHP 7.x, then register the bundle in your kernel and add its configuration. You also need the Elastic APM PHP agent installed and an APM Server reachable from the host. Expect to update or replace the package's Composer constraints, since the release predates PHP 8 and current agent versions.
Which PHP and Symfony versions does elastic-apm-bundle support?
The last release was tagged in January 2020, so it targets Symfony 4/5 era stacks and PHP 7.x runtimes. Compatibility with PHP 8+, Symfony 6/7, Laravel 9+ and current Elastic APM agent versions is unverified. Pin your runtime and framework versions before trialling it, and assume you will own any compatibility patches required.
Is spacespell/elastic-apm-bundle still maintained?
There is no evidence of active maintenance: the last release was 2020-01-21, there are zero dependents, and no visible CI or security response process. The repository has roughly 125 stars, which indicates historical interest but weak production validation. If you adopt it, budget for fork maintenance and a quarterly review of agent and APM Server compatibility.
What does elastic-apm-bundle instrument automatically?
It wraps the Elastic APM PHP agent and hooks into Symfony's HTTP kernel, event dispatcher, Doctrine and Twig to emit transactions, spans, errors and metrics. That gives you request timing, database query spans and template rendering visibility with minimal code changes. Laravel-specific request lifecycle events and queue workers are not covered by these listeners.
How is elastic-apm-bundle configured for APM Server?
You point it at your APM Server by setting the server URL, secret token, service name and environment, typically through bundle configuration or the agent's environment variables. The APM PHP agent must be loaded in the runtime before the bundle can send data. Validate the setup in staging by confirming that transactions and errors appear in Kibana before rolling out.
Should I use elastic-apm-bundle or the official Elastic APM PHP agent?
For most teams the official agent is the safer choice because it is actively maintained and supported on modern PHP. This bundle is essentially a thin convenience layer over that agent's Symfony integration, so you lose little by calling the agent APIs directly from middleware. In Laravel, a small custom middleware plus a service provider gives you equivalent HTTP transaction tracing.
Will elastic-apm-bundle trace queues, scheduled tasks and CLI commands?
Probably not out of the box. Its instrumentation is built around Symfony's HTTP kernel and Doctrine events, and it has no Laravel queue, scheduler or Artisan instrumentation. Confirm separately that queue workers and CLI commands are instrumented, often by starting transactions manually through the agent API.
What performance overhead does elastic-apm-bundle add in production?
Overhead comes mostly from the underlying Elastic APM PHP agent: span collection, serialization and background flushing to the APM Server. Enable sampling, tune the transaction sample rate, and define an acceptable overhead budget before rollout. Also agree a data retention policy for captured traces with your observability team.
What are the alternatives to elastic-apm-bundle for Laravel observability?
The main alternatives are the official Elastic APM PHP agent with a custom Laravel middleware and service provider, or standardizing on OpenTelemetry with an OTLP exporter. Laravel-native tools such as Telescope help with local debugging but are not a production APM replacement. Choose based on whether Elastic APM is already your approved observability backend.
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.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console