Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"There are no commands defined in the 'command' namespace." after running command:make in Laravel

Just like in title. I'm trying to run from artisan

php artisan command:make NameOfCommand

but all I see is

There are no commands defined in the "command" namespace.

Any idea what is this?

like image 273
Zbigniew Kisły Avatar asked Sep 04 '15 10:09

Zbigniew Kisły


3 Answers

As the documentation says (Current version is 5.2 at this moment):

Once your command is finished, you need to register it with Artisan so it will be available for use. This is done within the app/Console/Kernel.php file.

in the Kernel.php file you must add: protected $commands = [ Commands\NameOfCommand::class ];

(ref: https://laravel.com/docs/5.2/artisan#registering-commands)

like image 176
Alejandro Silva Avatar answered Oct 19 '22 14:10

Alejandro Silva


You have misplaced the command it is

php artisan make:command NameOfCommand

and not

php artisan command:make NameOfCommand

If you have simply write php artisan within your command prompt it'll show you the list of commands over there have a look

enter image description here

like image 38
Narendrasingh Sisodia Avatar answered Oct 19 '22 15:10

Narendrasingh Sisodia


In laravel 5.2 use php artisan make:console NameOfCommand

like image 5
Taytus Avatar answered Oct 19 '22 15:10

Taytus