Console Service Provider
CLI command registry and console runtime services.
Responsibility
Registers the CLI command registry used by CliKernel. ConsoleServiceProvider provides CommandRegistry; command loading, argument dispatch and command list output are handled by the CLI kernel.
Registration
CliKernel registers ConsoleServiceProvider during CLI bootstrap before common framework providers and configured application providers. It is CLI-only and is not part of the HTTP kernel request chain.
Command config
CLI commands are configured through app/Config/Commands.php. The file returns a list of class names implementing CommandInterface; the kernel validates each class and registers it by its runtime name().
<?php
declare(strict_types=1);
use App\Console\ExampleCommand;
use Lemonade\Framework\Queue\Cli\QueueInstallCommand;
use Lemonade\Framework\Queue\Cli\QueueWorkCommand;
return [
ExampleCommand::class,
QueueInstallCommand::class,
QueueWorkCommand::class,
];
Command contract
CommandInterface defines name(), description() and run(array $args): int. The command name is the CLI identifier; the description is shown in list; the integer return value is used as the process exit code.
use Lemonade\Framework\Cli\CommandInterface;
final class ExampleCommand implements CommandInterface
{
public function name(): string
{
return 'example:run';
}
public function description(): string
{
return 'Run an example CLI task.';
}
public function run(array $args): int
{
return 0;
}
}
Runtime usage
Run commands through the project executable. list, --help, -h or an empty command prints available registered commands. Unknown commands return exit code 1 and print the command list.
vendor/bin/lemonade list
vendor/bin/lemonade example:run
Provider boundary
ConsoleServiceProvider does not discover files, parse options or implement scheduling. It only supplies the registry; individual command classes own their arguments and behavior, while CliKernel owns bootstrap and dispatch.