PHP code example of speakol-ads / elastic-apm-laravel

1. Go to this page and download the library: Download speakol-ads/elastic-apm-laravel 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/ */

    

speakol-ads / elastic-apm-laravel example snippets


protected $middleware = [
    // ... more middleware
    \PhilKra\ElasticApmLaravel\Middleware\RecordTransaction::class,
];

$app->middleware([
    PhilKra\ElasticApmLaravel\Middleware\RecordTransaction::class
]);

// Use any normal Laravel method of resolving the dependency
$transaction = app(\PhilKra\ElasticApmLaravel\Apm\Transaction::class);

$span = $transaction->startNewSpan('My Span', 'app.component_name');

// do some stuff

$span->end();

\ElasticApm::captureThrowable($exception, [], request()->__apm__());
bash
php artisan vendor:publish --tag=config