Skip to content

Instantly share code, notes, and snippets.

@migrs
Last active April 9, 2017 20:46
Show Gist options
  • Save migrs/716cf7218e6953ee1789 to your computer and use it in GitHub Desktop.
Save migrs/716cf7218e6953ee1789 to your computer and use it in GitHub Desktop.
newrelic patch for laravel5.2
<?php namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
protected $middleware = [
\App\Http\Middleware\NewRelicPatch::class,
//... your other middlewares
];
//...
}
<?php
namespace App\Http\Middleware;
use Closure;
class NewRelicPatch
{
public function handle($request, Closure $next)
{
$response = $next($request);
event('router.filter:after:newrelic-patch', [$request, $response], true);
return $response;
}
}
<?php
Route::macro('after', function ($callback) {
$this->events->listen('router.filter:after:newrelic-patch', $callback);
});
@adirickyk
Copy link

awesome, man !!!
Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment