laravel/prompts
Laravel Prompts adds beautiful, user-friendly interactive forms to PHP CLI apps and Artisan commands. It supports placeholder text, validation, and a browser-like input experience, making it easy to collect and validate user input in the terminal.
question helpers with a more intuitive, browser-like UI (e.g., placeholders, validation, dynamic steps).DataTable, Grid, and Task prompts enable complex workflows (e.g., CRUD operations in CLI).FormStep::conditional()) enables multi-step CLI forms, mirroring web form builders but for terminal UIs. Ideal for interactive CLI tools (e.g., migrations, deployments, or admin tasks).spin() for background tasks) and non-interactive mode (CI/CD pipelines), reducing friction in automated workflows.Console component under the hood.symfony/console (already in Laravel), with no heavyweight dependencies. ~1MB footprint.required, email) and Symfony’s validators, enabling reuse of existing logic.echo "Hello"). Better suited for interactive tools with >3 prompts.symfony/console test helpers.confirm() in existing commands).// Before
if (!$this->confirm('Proceed?')) exit;
// After
$proceed = Prompt::confirm('Proceed?');
if (!$proceed) exit;
handle() method logic with Prompt-driven flows:
$name = Prompt::text('Enter name');
$email = Prompt::email('Enter email');
$user = User::create(compact('name', 'email'));
question helpers during migration.| Component | Compatibility | Notes |
|---|---|---|
| Laravel 10+ | ✅ Full support | Tested up to Laravel 13. |
| PHP 8.1+ | ✅ Required | PHP 8.0 may work but untested. |
| Symfony Console | ✅ Direct compatibility | Underlying dependency. |
| Windows CMD | ⚠️ Partial (ANSI support required) | Use Windows Terminal or enable ANSI. |
| CI/CD Pipelines | ✅ Non-interactive mode (--non-interactive flag) |
Ideal for automated workflows. |
| Custom Validation | ✅ Laravel/Symfony validators | Extend with custom rules if needed. |
composer.json and publish assets (if using custom themes).php artisan migrate:fresh --interactive).composer.json during production use.select prompt).
How can I help you explore Laravel packages today?