Laravel 5.5 Package Commands Won't Register

675 views Asked by At

I have a package for Laravel 5.5 and in the CommandsServiceProvider boot() method, I have:

if($this->app->runningInConsole()){
    $this->commands([
        MyCommandClass:class,
    ]);
}

Then, my MyCommandClass looks like:

<?php

namespace Testing\Commands;

use Illuminate\Console\Command;

class MyCommandClass extends Command
{
    protected $signature = "execute:test";

    protected $description = "Description of the command";

    public function __construct()
    {
        parent::__construct();
    }

    public function handle()
    { 
        $this->info('Command Executed');
    }
}

The issue is that Artisan does not list the command when I run php artisan and when I try to run the command with php artisan execute:test it tells me the command is not defined.

What am I missing here? I followed the documentation for registering package commands in Laravel 5.5

1

There are 1 answers

0
Ryanthehouse On

It would appear that the Auto discovery only works when pulling a package from a Git Repo via Composer. When developing a package, the composer files within the package do not seem to auto load.