illuminate/console
Illuminate Console provides the Artisan command-line framework used by Laravel. Define commands, schedule tasks, manage input/output, prompts, and terminal styling, and integrate with the service container to build robust CLI tools and automation.
Start by installing the package via Composer: composer require illuminate/console. This package powers Laravel’s CLI (Artisan), but can be used standalone in any PHP project. To create your first command, extend Illuminate\Console\Command and implement the handle() method. Register commands in a Symfony\Component\Console\Application instance — use Application::setCommandName() to set the app name and add() to include commands. Run php your-script.php list to see available commands. The Laravel documentation’s Artisan section provides excellent reference examples, as this package is the core behind Artisan.
configure() to set name, description, and arguments/options; handle() contains the logic; return self::SUCCESS or self::FAILURE.resolve().$app = new Application('MyCLI', '1.0.0');
$app->add(new MyCommand());
$app->run();
$this->info(), $this->error(), $this->ask(), $this->confirm() for user interaction and styled output.Tests\TestCase (if using Laravel) or use Symfony\Component\Console\Tester\CommandTester for unit testing commands.make(), inject() in handle()) won’t work unless you manually resolve dependencies or bootstrap the container.$this->laravel->instance('Illuminate\Console\Application', $this->getApplication()) if you need access to Laravel’s app bindings inside commands without full Laravel.protected $hidden = true; to omit from the list output — useful for internal commands.ask(), confirm()) fail in headless environments — guard with $this->input->isInteractive().getHelperSet() for custom Symfony helpers, or extend Symfony\Component\Console\Input\InputDefinition to inject global options.bash-completion via Application::registerCommandName() and provide completion commands (Artisan has this built-in; replicate manually if needed).How can I help you explore Laravel packages today?