PHP code example of samuelnogueira / new-relic-middleware

1. Go to this page and download the library: Download samuelnogueira/new-relic-middleware 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/ */

    

samuelnogueira / new-relic-middleware example snippets


 // config/pipeline.php

use Samuelnogueira\ZendExpressiveNewRelic\Middleware\NewRelicMiddleware;
use Samuelnogueira\ZendExpressiveNewRelic\Middleware\NewRelicTransactionNameMiddleware;
use Mezzio\Router\Middleware\RouteMiddleware;
use Mezzio\Application;

return static function (Application $app): void {
    // (...)
    
    // Profiling middleware 2nd most outer middleware to profile everything
    if (extension_loaded('newrelic')) {
        $app->pipe(NewRelicMiddleware::class);
    }
    
    // (...)

    // Register the routing middleware in the middleware pipeline
    $app->pipe(RouteMiddleware::class);

    // Add more middleware here that needs to introspect the routing results; this
    // might