refinery29/newrelic

Provides a wrapper around the NewRelic agent

1.1.0 2017-09-05 14:05 UTC

This package is not auto-updated.

Last update: 2024-03-27 22:05:39 UTC


README

Build Status Code Climate Test Coverage Issue Count Latest Stable Version Total Downloads

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');

💡 Ideally, you should create one instance of 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.