laravel/prompts
Laravel Prompts adds beautiful, user-friendly interactive forms to PHP CLI apps. Ideal for Laravel Artisan commands, with browser-like touches such as placeholders and built-in validation. Usable in any command-line PHP project.
CLI Tooling & Developer Experience (DX):
Internal Developer Platforms (IDPs):
Build vs. Buy:
Inquirer (PHP port) is cross-platform, it lacks Laravel integration and modern features like task lists or progress bars.Use Cases (Expanded):
readline() scripts with modern Prompts-based tools.Adopt if:
Look elsewhere if:
Inquirer.js for Node.js or click for Python).input() calls—use native PHP).Symfony/UX or Electron.*"Laravel Prompts v0.3.18 is now production-ready for all environments, including Windows, Laravel Sail, and CI/CD pipelines. This means we can safely build self-service CLI tools (e.g., ‘Deploy with one command’ or ‘Reset DB in 3 clicks’) that work everywhere—no more ‘it works on my Mac but not in GitHub Actions.’
Key Wins:
ROI:
Ask: Should we pilot this for [INITIATIVE X] CLI tools in Q2? Early adopters include [Team Y], who’ve already replaced 3 legacy scripts with Prompts forms."*
*"v0.3.18 fixes critical gaps for production use. Here’s what changed and how to leverage it:
Critical Fixes:
--no-interaction flag works as expected).Why Upgrade Now?
Migration Path:
form() method:
$response = Prompt::form()
->text('name')
->select('environment')->options(['local', 'staging', 'prod'])
->spinner('processing')->while(fn() => sleep(1))
->submit();
--no-interaction mode works for your pipelines.Example: Cross-Platform Deploy Tool
// Works on Windows, Linux, and macOS (including Sail/CI)
$deploy = Prompt::form()
->confirm('proceed', 'Deploy to production?')
->spinner('deploying')->while(fn() => deployScript())
->task('tasks', 'Running post-deploy checks...', fn() => runChecks())
->submit();
Tech Debt Note:
How can I help you explore Laravel packages today?