unpad-dev / elastic-apm-php-agent-laravel
Additional Features for Elastic APM PHP Agent when using Laravel 9+ Framework
Installs: 25
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Forks: 0
pkg:composer/unpad-dev/elastic-apm-php-agent-laravel
Requires
- php: ^8.0.2
Requires (Dev)
- elastic/apm-agent: *
- laravel/framework: ^9.19
This package is not auto-updated.
Last update: 2025-12-19 21:49:42 UTC
README
Additional Features for Elastic APM PHP Agent when using Laravel 9+ Framework
Features
- Artisan Transaction Name with arguments and options
- Job Transaction for
queue:workandqueue:listen - Job Process in Job Transaction
- Controller Process in Request Transaction
Installation
1. Install Elastic APM PHP Agent
Debian 11
- Install Elastic APM PHP Agent according to the instructions at
https://www.elastic.co/guide/en/apm/agent/php/1.x/setup.html - Configure APM PHP Agent until it appears in
phpinfo()(PHP FPM) and also appears inphp --ini(PHP Cli) - Make sure the configuration works using Kibana (which is connected to the Elastic APM Server) on the
Observability - APMmenu where theelastic_apm.service_namevalue in the php ini file is shown as a ServiceDocker
- Use unpad-nginx-php8.1 Docker Image with version 1.1+
- Make sure to use this Environments below to running the docker container
| Env | Value | Description |
|---|---|---|
| APM_ENABLED | true | Elastic APM PHP Agent Status |
| APM_SERVER_URL | http://elastic-apm-host:8200 | URL for Elastic APM server |
| APM_SERVICE_NAME | App Name | The application name |
- Make sure the docker environments works using Kibana (which is connected to the Elastic APM Server) on the
Observability - APMmenu where theAPM_SERVICE_NAMEvalue in the container environment is shown as a Service
2. Install Package
Once the PHP APM Elastic Agent is installed, install this package using composer
$ composer require unpad-dev/elastic-apm-php-agent-laravel
Usage for Job Process
Attach Middleware \UnpadDev\ElasticApm\Middleware\JobMiddleware to every Job in the job's middleware method to show Job Process in Elastic APM
use UnpadDev\ElasticApm\Middleware\JobMiddleware;
/**
* Get the middleware the job should pass through.
*
* @return array
*/
public function middleware()
{
return [new JobMiddleware];
}