2017 © Pedro Peláez
 

cakephp-plugin cakephp-newrelic

CakePHP <3 NewRelic

image

jippi/cakephp-newrelic

CakePHP <3 NewRelic

  • Saturday, July 28, 2018
  • by jippi
  • Repository
  • 5 Watchers
  • 13 Stars
  • 43,125 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 7 Forks
  • 0 Open issues
  • 2 Versions
  • 10 % Grown

The README.md

CakePHP <3 NewRelic

You can modify your files like this, (*1)

Things included

  • NewRelic.NewRelic task
  • NewRelic.NewRelic component
  • NewRelicTrait trait
  • NewRelic.NewRelic

Installation

composer require jippi/cakephp-newrelic

Console

Include this snippet in app/Console/AppShell.php, (*2)

    public function startup() {
        $this->NewRelic = $this->Tasks->load('NewRelic.NewRelic');
        $this->NewRelic->setName($this);
        $this->NewRelic->start();
        $this->NewRelic->parameter('params', json_encode($this->params));
        $this->NewRelic->parameter('args', json_encode($this->args));

        parent::startup();
    }

Controller

Simply add NewRelic.NewRelic to your $components list, (*3)

app/webroot/index.php

Add this in top of your file before define('DS', 'DIRECTORY_SEPARATOR'), (*4)

 CakePHP 3.3.0 and using middleware
If you utilise CakePHP middlewares from https://book.cakephp.org/3.0/en/controllers/middleware.html 

You can use the supplied `NewRelicErrorHandlerMiddleware` placed in `NewRelic\Middleware\NewRelicErrorHandlerMiddleware` which extends the built in `Cake\Error\Middleware\ErrorHandlerMiddleware`. By using this you'll get the NewRelic working *and* have default CakePHP behavior.

Example:

```php
add(\NewRelic\Middleware\NewRelicErrorHandlerMiddleware::class)
            // Handle plugin/theme assets like CakePHP normally does.
            ->add(AssetMiddleware::class)
            // Apply routing
            ->add(RoutingMiddleware::class);
        
        return $middleware;
    }
}

?>

The Versions

28/07 2018

dev-master

9999999-dev https://github.com/jippi/cakephp-newrelic

CakePHP <3 NewRelic

  Sources   Download

MIT

The Requires

 

plugin cakephp newrelic apm

29/06 2018