Brian Brian - 1 month ago 4x
PHP Question

Newrelic isn't recognizing my Slim PHP routes

I have just set up New Relic on my PHP web app. Everything is working great except one thing... All of the transactions show as going through "index.php".

The reason for this because I'm using the Slim framework (there are many alternatives for routing) with URL rewriting so that I can have nice human URLs like "/user/settings" without a folder for every controller and action.

But that still leaves me with

as the name for every New Relic web transaction.


You can use a hook to set the transaction name to the name or pattern of the router.

Here is an example setting it to the pattern:

$app->hook('slim.before.dispatch', function() use ($app) {