CakePHP New Relic plugin.
CakePHP New Relic plugin.
This plugin extends the CakePHP Request cycle, adding
a specialized Dispatcher Filter that adds
support for New Relic. The current version supports:
For more information, visit:
PHP Frameworks: Integrating support for New Relic
This plugin has the following requirements:
Development requirements:
Install the plugin using Composer, executing the
following command in your project’s root directory (where the composer.json
file is located.)
composer require brunitto/cakephp-new-relic
Add the Dispatcher Filter to the bootstrap.php
file:
// New Relic name transaction dispatcher filter
DispatcherFactory::add('NewRelic.NameTransaction');
Add the Middleware to the src/Application.php
file after theRoutingMiddleware
:
$middlewareQueue
->add(new RoutingMiddleware($this))
->add(new NameTransactionMiddleware());
Load the plugin helper within src/View/AppView.php
, add the following line
within the initialize()
method:
$this->loadHelper('NewRelic.NewRelic');
Like this:
public function initialize()
{
parent::initialize();
$this->loadHelper('NewRelic.NewRelic');
}
In your Layouts files, use
the NewRelic
helper methods to get the browser timing header and footer.
The header goes right before the </head>
element:
<head>
...
<!-- NEW RELIC BROWSER TIMING HEADER -->
<?= $this->NewRelic->getBrowserTimingHeader() ?>
</head>
And the footer goes right before the </body>
element:
<body>
...
<!-- NEW RELIC BROWSER TIMING FOOTER -->
<?= $this->NewRelic->getBrowserTimingFooter() ?>
</body>
This plugin is ready for Middleware, as defined in:
Install using composer
program:
$ composer install --ignore-platform-reqs
Run using phpunit
program:
$ vendor/bin/phpunit tests --color
development
and merge master
, starting from the last stabledevelopment
, commiting and pushing to origin
when you have, fix #N
suffix in commit messages, where #N is thedevelopment
is ready to go, merge in master
and creates two1.2.3
and the stable
tag. It might be necessarystable
tag before pushing. The version tag is used by GitHub andmaster
to origin
including the tags and wait for Travis CI toIf you have some problem with this plugin, please open an issue on:
https://github.com/brunitto/cakephp-new-relic/issues
If you’d like to contribute, you can fork the project, add features and send
pull requests in the official repository: