1. Go to this page and download the library: Download anik/elastic-apm-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
anik / elastic-apm-php example snippets
// COMMENT THIS SECTION
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
// USE THIS SECTION FOR LARAVEL <= 7
$app->singleton(Illuminate\Contracts\Debug\ExceptionHandler::class, function ($app) {
return new Anik\ElasticApm\Exceptions\Handler(new App\Exceptions\Handler($app), [
// NotFoundHttpException::class, // (1)
// ConnectException::class, // (2)
]);
});
// USE THIS SECTION FOR LARAVEL >= 8
$app->singleton(Illuminate\Contracts\Debug\ExceptionHandler::class, function ($app) {
return new Anik\ElasticApm\Exceptions\HandlerThrowable(new App\Exceptions\Handler($app), [
// NotFoundHttpException::class, // (1)
// ConnectException::class, // (2)
]);
});
// COMMENT THIS SECTION
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
// USE THIS SECTION FOR LUMEN <= 7
$app->singleton(Illuminate\Contracts\Debug\ExceptionHandler::class, function ($app) {
return new Anik\ElasticApm\Exceptions\Handler(new App\Exceptions\Handler(), [
// NotFoundHttpException::class, // (1)
// ConnectException::class, // (2)
]);
});
// USE THIS SECTION FOR LUMEN >= 8
$app->singleton(Illuminate\Contracts\Debug\ExceptionHandler::class, function ($app) {
return new Anik\ElasticApm\Exceptions\HandlerThrowable(new App\Exceptions\Handler(), [
// NotFoundHttpException::class, // (1)
// ConnectException::class, // (2)
]);
});