I have developed some custom artisan command for easier use with my package. Is it possible to include the artisan command into the package for easier deployment? If can, how?>
Having a command set in your package structure:
You can, in your package Service Provider:
registerMyCommand();
$this->commands('mycommand');
}
private function registerMyCommand()
{
$this->app['mycommand'] = $this->app->share(function($app)
{
return new MyCommand;
});
}
}
The trick is in the line
$this->commands('mycommand');
Which tells Laravel to add your command to the artisan list of commands available.