PHP code example of nicolas-cajelli / slim-newrelic

1. Go to this page and download the library: Download nicolas-cajelli/slim-newrelic 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/ */

    

nicolas-cajelli / slim-newrelic example snippets



$config['responseHandlers'] = function(ContainerInterface $c) {
    return [
        $c->get(BadRequestJsonResponseHandler::class),
        $c->get(NewrelicResponseHandler::class),
    ];
};

$app->add(NewRelicTransactionMiddleware::class);


$config['settings']  = [
    // ...
    'newRelic' => [
        'licenseKey' => 'your-license',
        'appName' => 'your-app'
    ]
    // ...
];

$config[NewRelicTransactionMiddleware::class] = function(ContainerInterface $c) {
    $middleware = new NewRelicTransactionMiddleware($c);
    $middleware->addTransactionDecorator(CustomDecorator::class);
    $middleware->setTransactionNaming(CustomNamingPolicy::class);
    return $middleware;
};