Just a quick post for those of you trying out Laravel 5.2 that was released the other day.

When running `composer create-project laravel/laravel l52 –prefer-dist` I was seeing after the `php artisan clear-compiled` was run.

Method after does not exist.

After the install was completed running any artisan command resulted in this error as well.

So I asked about this on larachat and got pointed towards my `laravel.log` where I found the full error

[2015-12-23 09:06:51] local.ERROR: exception 'BadMethodCallException' with message 'Method after does not exist.' in /home/forge/l52/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php:81
Stack trace:
#0 /home/forge/l52/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(17): Illuminate\Routing\Router->__call('after', Array)
#1 /home/forge/l52/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(17): Illuminate\Routing\Router->after(Object(newrelic\Laravel\AfterFilter))
#2 /home/forge/l52/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(17): Illuminate\Foundation\Application->boot()
#3 /home/forge/l52/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(203): Illuminate\Foundation\Bootstrap\BootProviders->bootstrap(Object(Illuminate\Foundation\Application))
#4 /home/forge/l52/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(208): Illuminate\Foundation\Application->bootstrapWith(Array)
#5 /home/forge/l52/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(105): Illuminate\Foundation\Console\Kernel->bootstrap()
#6 /home/forge/l52/artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 {main}

the line that immediately leaped out to me was

#1 /home/forge/l52/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(17): Illuminate\Routing\Router->after(Object(newrelic\Laravel\AfterFilter))

which made me realise it was related to New Relic on my server. Which made more sense as I’d been running 5.2 fine on my local machine.

Seems that something has changed in Laravel 5.2 that the New Relic PHP Agent doesn’t currently support.

So in the mean time the simple solution is to do

php5dismod newrelic

to disable the module.

This isn’t ideal obviously but for now it will get your artisan working again. I’m going to follow up with New Relic and will update this if I find a better solution.

Share this post


  1. Matt

    ran into this too.. Any proper fix?

  2. This patch worked for me – https://gist.github.com/migrs/716cf7218e6953ee1789 hopefully NR will have an official fix out sooner than later.

Leave a Reply

CAPTCHA (required) Time limit is exhausted. Please reload CAPTCHA.