Download the PHP package casonwebdev/elastic-apm-php without Composer
On this page you can find all versions of the php package casonwebdev/elastic-apm-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download casonwebdev/elastic-apm-php
More information about casonwebdev/elastic-apm-php
Files in casonwebdev/elastic-apm-php
Package elastic-apm-php
Short Description elastic/apm-agent-php wrapper to push PHP application transactions to APM Server
License MIT
Informations about the package elastic-apm-php
Elastic APM PHP
:warning: WARNING: The package dependency ext-elastic_apm
is in development mode that pushes breaking changes now and then. Also discouraged to use in a production environment. Thus this project will unmaintained till the stability of the dependency gets resolved. Feel free to fork and change accordingly. Or use any available alternative
Requirements
- The package depends on elastic's apm-agent-php extension.
- php
^7.2
- If want to use with Laravel, Laravel version >=
6.x
.
Installation
To install the package with composer, run:
Use the appropriate version while installing if you want any specific version. Above command will install the latest available version.
Laravel
- This package uses Laravel's auto discovery feature. But, if you still want to install, then
- Add
Anik\ElasticApm\Providers\ElasticApmServiceProvider::class
in yourconfig/app.php
's providers array. - Add
Anik\ElasticApm\Facades\Agent::class
in yourconfig/app.php
's facade array. php artisan vendor:publish
and select the provider to publish the config file in your config directory. It'll copyelastic-apm.php
in your config directory.
- Add
Lumen
- To install this package with your lumen, you don't need to enable Facade.
- Register the service provider in your
bootstrap/app.php
with$app->register(Anik\ElasticApm\Providers\ElasticApmServiceProvider::class);
- Copy the
elastic-apm.php
fromvendor/anik/elastic-apm-php/src/config/elastic-apm.php
in yourconfig/app.php
file if you want to change the configuration. - Register the copied config file
$app->configure('elastic-apm')
in yourbootstrap/app.php
Usage
Error Tracking
If you want to keep the records of Errors, then
-
For Laravel, in your
bootstrap/app.php
, - For Lumen, in your
bootstrap/app.php
,
Request Response Tracking
If you want to keep the records of Request received and served by your application,
-
For Laravel, in your
App\Http\Kernel
's middleware, addAnik\ElasticApm\Middleware\RecordForegroundTransaction
class. - For Lumen, in your
bootstrap/app.php
file, addAnik\ElasticApm\Middleware\RecordForegroundTransaction
class.
Background Job Tracking
For both the Laravel & Lumen, you'll have to add Anik\ElasticApm\Middleware\RecordBackgroundTransaction
class as your Job's middleware.
HTTP Call tracking
To track the HTTP calls, you'll need to use Guzzle. You can pass the RecordHttpTransaction
class as your Guzzle's handler stack. It'll then record HTTP calls as well.
Documentation
Please check the given URL in the project description to get a thorough view of what you can do with it. And how to customize it.
PRs?
If you find any bug and update, please make sure you send a PR. PRs are always appreciated.