Search code examples
phplaravel-4composer-phppsr-0

Class RemindersController does not exist


I changed the app/controllers to app/Controllers, add in composer.json file:

"psr-0": {
    "Controllers": "app/",
    "Test":"app/"
}

In my controllers, i add:

namespace Controllers;

When i was update with composer, the following error:

L:\USB\Test>composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
{"error":{"type":"ReflectionException","message":"Class RemindersController does
 not exist","file":"L:\\USB\\Test\\vendor\\laravel\\framework\\src\\Illuminate\
\Routing\\ControllerInspector.php","line":28}}{"error":{"type":"ReflectionExcept
ion","message":"Class RemindersController does not exist","file":"L:\\USB\\Test
\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\ControllerInspector.php"
,"line":28}}

Solution

  • since you added a namespace "Controllers" to classes that did not previously have them, did you also update all of your routes that use the controller's name? for example:

    Route::controller('reminders', '\Controllers\RemindersController');
    

    and

    route(\Controllers\RemindersController@getIndex);