sobanvuex / php-newrelic
PHP Library for New Relic Agent
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 518 653
Dependents: 6
Suggesters: 0
Security: 0
Stars: 14
Watchers: 1
Forks: 4
Open Issues: 1
Requires
- php: >=5.4.0
Requires (Dev)
- apigen/apigen: ~4.0
- phpunit/phpunit: ~4.0
- pimple/pimple: ~3.0
- squizlabs/php_codesniffer: ~2.0
Suggests
- ext-newrelic: Get the New Relic PHP extension from http://newrelic.com
- pimple/pimple: Pimple is a small dependency injection container for PHP
README
OOP Wrapper for NewRelic's PHP Agent.
Installation
To install, use composer:
composer require SobanVuex/php-newrelic:~2.0
Usage
Use the Agent directly or with your own DI with \SobanVuex\NewRelic\Agent
.
Examples
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');
Testing
$ ./vendor/bin/phpunit
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.