Q:

Why does my app crash when I change my namespace?

I'm following the material given in the book Easy Laravel 5 to learn Laravel. So I created the app as directed, and when I visited localhost:8000, I saw the welcome page.
Then I gave the name change command:
php artisan app:name todoparrot

To which the system responded with Application namespace set!. But now when I reload localhost:8000, I see nothing, and the terminal serving the app gives me a long list of errors:
PHP Fatal error:  Uncaught exception 'ReflectionException' with message 'Class todoparrot\Console\Kernel does not exist' in /media/common/htdocs/todoparrot/vendor/laravel/framework/src/Illuminate/Container/Container.php:776
Stack trace:
#0 /media/common/htdocs/todoparrot/vendor/laravel/framework/src/Illuminate/Container/Container.php(776): ReflectionClass->__construct('todoparrot\Cons...')
#1 /media/common/htdocs/todoparrot/vendor/laravel/framework/src/Illuminate/Container/Container.php(656): Illuminate\Container\Container->build('todoparrot\Cons...', Array)
#2 /media/common/htdocs/todoparrot/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(613): Illuminate\Container\Container->make('todoparrot\Cons...', Array)
#3 /media/common/htdocs/todoparrot/vendor/laravel/framework/src/Illuminate/Container/Container.php(229): Illuminate\Foundation\Application->make('todoparrot\Cons...', Array)
#4 /media/common/htdocs/todoparrot/vendor/laravel/framework/src/Illuminate/Container/Container.php(773): Illuminate\Container\Con in /media/common/htdocs/todoparrot/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 776

Now I'm not able to even run artisan, as I keep getting the same error. Any idea what might be broken because of this extremely simple change?

A:

Try this command after renaming:
composer dump-autoload

Composer has autoload files at vendor/composer/ directory with your namespaces. when you change any you need to clear it and generate it again, and that command does it.

