Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

HardDrive's avatar

Custom command not showing in php artisan list

I'm using Laravel 8.2 and have created a custom command using

php artisan make:command GetAssignedUser

When I run 'php artisan list' it doesn't show up. I have tried adding to the $commands array in Kernel.php and it complains of the class already existing. I have since read the docs and can see all commands in the Commands folder are automatically loaded so have also tried without. I have also tried dumping the autoload file.

I'm not sure what to try next

0 likes
4 replies
fylzero's avatar

@rossuk Did you open app/Console/Commands/GetAssignedUser.php and set up the $signature and $description?

HardDrive's avatar

Yes I did

?php

namespace App\Console\Commands;
namespace App\Client;

use Illuminate\Console\Command;
use App\Models\Client;


class GetAssignedUser extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'client:GetAssignedUser';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Gets allocated user from and send mail notification';
    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
	...
HardDrive's avatar
HardDrive
OP
Best Answer
Level 2

I had two namespace declarations all good once I removed the

namespace App\Client;

Thanks anyway

ishahzeb's avatar

Well, there is another solution if you faced the same problem again, In order to list the artisan commands including the custom ones, you have to invoke the systems PHP CLI Interpreter specifically PHP call. To view a list of all available Artisan commands, you may use the following list command.

php-cli artisan list

Please or to participate in this conversation.