Skip to content

refinery29/newrelic

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

newrelic

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.