A five-minute tour: install laranail/console, print your first styled output, and read your first prompt.
For the full reference see the Documentation index.
composer require laranail/consoleThe Console and Prompter facades + the prompter() helper are auto-discovered. Optionally publish the
config + language files:
php artisan vendor:publish --tag=laranail::console-config
php artisan vendor:publish --tag=laranail::console-langInside an Artisan command you have $this->output; anywhere else pass any Symfony OutputInterface.
Markup-bearing helpers go through the output; finished-string renderers echo fine:
use Simtabi\Laranail\Console\Facades\Console;
$output->writeln(Console::status()->success('Build complete'));
echo Console::box(['Name: app', 'Env: prod'])->title('Config')->render();
echo Console::tree('project')->child('src', fn ($t) => $t->child('Console'))->render();Know which of the three output styles a helper returns — it
decides whether you writeln() or echo.
| Style | Examples | How to print it |
|---|---|---|
Symfony Console markup (<fg=green>…</>) |
Console::status()->success(), ConsoleUIFormatter::success(), badge(), link() |
$output->writeln(...) (in a command, $this->line(...)). echo prints the tags literally. |
| Finished string | render() on Console::box(), Console::tree(), Console::table() and the other string-returning widgets; colorize() |
echo, or writeln() |
| Self-writing | Spinner, ProgressBar, TaskProgress |
Nothing to print: they write to the OutputInterface they are given and have no render(). |
See Output widgets and Formatting for which helper is which.
Console::spinner('Compiling…')->run(fn () => compile());
$name = Console::prompter()->text('Your name', required: true)->getResult();- Output widgets — spinner, progress, box, tree, table, gauge, charts…
- Prompts & forms — the Prompter, forms, and validators.
- Design system — theming, typography, documents, responsiveness.
- Configuration — every
config/laranail/console.phpkey.