OOP Wrapper for NewRelic's PHP Agent.
To install, use composer:
composer require SobanVuex/php-newrelic:~2.0
Use the Agent directly or with your own DI with \SobanVuex\NewRelic\Agent
.
Or using Pimple
with \SobanVuex\NewRelic\Provider\Pimple\AgentPrivoder
.
Setting the application name
$newrelic = new SobanVuex\NewRelic\Agent('MyApp');
// or
$newrelic = new SobanVuex\NewRelic\Agent('MyApp1;MyApp2');
// or
$newrelic = new SobanVuex\NewRelic\Agent(['MyApp1', 'MyApp2']);
$newrelic = new SobanVuex\NewRelic\Agent();
$newrelic->setAppname('MyApp');
// or
$newrelic->setAppname('MyApp1;MyApp2');
// or
$newrelic->setAppname(['MyApp1', 'MyApp2']);
Mark a transaction as a background job
$newrelic = new SobanVuex\NewRelic\Agent();
$newrelic->backgroundJob();
// or
$newrelic->backgroundJob(PHP_SAPI == 'cli');
Name a transaction
$newrelic = new SobanVuex\NewRelic\Agent();
$newrelic->nameTransaction('myController/myAction');
$ ./vendor/bin/phpunit
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.