mdx-dev / li3_newrelic
A Lithium PHP plug for New Relic
Installs: 25 980
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 80
Forks: 1
Open Issues: 1
Type:lithium-library
Requires
This package is not auto-updated.
Last update: 2024-11-09 13:34:28 UTC
README
New Relic plugin for Lithium PHP applications.
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); } } ?>