Try running
composer dump-autoload -o
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have recently upgraded Laravel to version 5.1 from 5.0, but whenever I send an API response to the server, it throws an exception like the following:
ReflectionException in RouteDependencyResolverTrait.php line 57: Class App\Http\Requests\User\GetRequest does not exist
Before upgrading everything was working fine.
This is the autoload section of my composer.json file:
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/",
"Bloom\\" : "library/Bloom"
}
}
Could it be that I did something went wrong during the upgrade procedure?
This is how the GetRequest class is declared:
<?php namespace App\Http\Requests\User;
use App\User;
use App\Http\Requests\Request;
use Illuminate\Support\Facades\Auth;
/**
* Class GetRequest
* @package App\Http\Requests\User
*/
class GetRequest extends Request {
Update: I just reinstalled Laravel 5.1 and moved all the old files to the new installation but I still receive the same error.
Update 2: After running php composer dump-autoload -o I can notice that the file vendor/composer/autoload_classmap.php contains the class that Laravel is unable to find:
'App\\Http\\Requests\\User\\GetRequest' => $baseDir . '/app/Http/Requests/User/GetRequest.php',
OK, I found the solution.
I noticed that if in GetRequest class I swap use App\Http\Requests\Request; with use Request; then the GetRequest class is found and the ReflectionException is not thrown anymore.
So the problem is not in the App\Http\Requests\User\GetRequest class but in the abstract class App\Http\Requests\Request.
After looking at the App\Http\Requests\Request class, to which I made changes, I decided to replace it with the dist version from Laravel and then I reapplied my changes.
Long story short: The problem was in App\Http\Requests\Request because I made changes to it and something changed with the update to Laravel 5.1.
Please or to participate in this conversation.