newrelic
This repository provides a wrapper around the New Relic PHP API,
inspired by intouch/newrelic
.
Installation
Run
$ composer require refinery29/newrelic
Usage
use Refinery29\NewRelic\Agent;
$agent = new Agent();
$agent->setAppname('Refinery29 API');
$agent->nameTransaction('POST /entries');
Refinery29\NewRelic\Agent
, share it using a container,
and inject it as a dependency into objects wishing to consume it.
Handlers
If you don't inject a handler, Refinery29\NewRelic\Agent
creates an instance of Refinery29\NewRelic\Handler\DefaultHandler
and uses it to make calls to the New Relic API.
You may want to inject a NullHandler
if you don't want to actually make calls to the New Relic API, for example,
in non-production environments:
use Refinery29\NewRelic\Agent;
use Refinery29\NewRelic\Handler;
$handler = new Handler\NullHandler();
$agent = new Agent($handler);
$agent->setAppname('Refinery29 API');
$agent->nameTransaction('POST /entries');
Contributing
Please have a look at CONTRIBUTING.md
.
Code of Conduct
Please have a look at CONDUCT.md
.
License
This package is licensed using the MIT License.