New Relic plug-in for Lithium PHP applications
PHP
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config
extensions
tests/cases/extensions
.gitignore
.travis.yml
README.md
composer.json

README.md

li3_newrelic

New Relic plugin for Lithium PHP applications.

Build Status

Installation

Composer

{
    "require": {
        ...
        "mdx-dev/li3_newrelic": "dev-master"
        ...
    }
}
php composer.phar install

Submodule

git submodule add git://github.com/mdx-dev/li3_newrelic.git libraries/li3_newrelic

Clone Directly

git clone git://github.com/mdx-dev/li3_newrelic.git libraries/li3_newrelic

Setting up

If you do not provide a shouldRun key a generic closure will be provided identical to the example below.

<?php
// ...
Libraries::add('li3_newrelic', array(
	'shouldRun' => function() {
		return Environment::is('production') && extension_loaded('newrelic');
	}
));
// ...
?>

Usage

The Newrelic extension puts an OO wrapper around their built in function calls so calling Newrelic::notice_error calls newrelic_notice_error. Here is an available list of php newrelic functions.

<?php

namespace app\controllers;

use Exception;
use li3_newrelic\extensions\Newrelic;

class UserController extends \lithium\action\Controller {

	function create() {
		try {
			// some fun stuff here!
		} catch (Exception $e) {
			// Magic
			Newrelic::notice_error('UserCreate/Error', $e);
		}
	}

?>