zcuric / laravel-artisan-choose
Searchable Artisan command chooser inspired by just --choose.
Requires
- php: ^8.2
- illuminate/console: ^10.0|^11.0|^12.0|^13.0
- illuminate/support: ^10.0|^11.0|^12.0|^13.0
- laravel/prompts: ^0.1.24|^0.2.0|^0.3.0|^0.4.0
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0|^10.0|^11.0
- phpunit/phpunit: ^10.5|^11.5
README
php artisan choose adds a searchable command picker to Laravel, inspired by just --choose.
Instead of remembering every Artisan command name, you can open an interactive chooser, search by command name, alias, or description, inspect command details, and run the selected command immediately.
Features
- Search visible Artisan commands by name, alias, or description
- Browse the full command list by pressing
Enteron an empty search box - See command description, aliases, and usage while moving through the list
- Generate interactive forms for command arguments and options
- Keep a raw arguments / options escape hatch for advanced cases
- Keep normal Artisan behavior after selection, including nested prompts and console output
Requirements
- PHP 8.2+
- Laravel 10, 11, 12, or 13
Installation
composer require zcuric/laravel-artisan-choose
Laravel package discovery registers the service provider automatically.
Usage
Start the chooser:
php artisan choose
Interactive flow:
- Press
Enteron an empty search box to browse all available commands. - Type to narrow the list by command name, alias, or description.
- Use the arrow keys to highlight a command.
- Press
Enterto select it. - Fill in the generated prompts for the selected command's arguments and options.
- Optionally enter extra raw Artisan arguments or options for advanced cases.
The generated forms currently handle the most reliable command-definition shapes automatically:
- required and optional arguments
- array arguments
- boolean flags
- negatable options
- required and optional value options
- array value options
For example, after the generated prompts you can still append raw input such as:
Taylor --yell
--force
--seed --database=testing
The chooser then executes the selected command through the current Artisan application. Commands with no custom arguments or options skip straight to the raw-input fallback prompt.
Examples
Choose demo:greet-style commands and answer generated prompts for required arguments and flags:
php artisan choose
Choose migrate and still use the raw fallback:
--force
Choose make:controller, answer the generated prompts, and optionally append raw input:
Admin/UserController --resource
Behavior
- Hidden Artisan commands are excluded from the chooser.
- The
choosecommand does not list itself. - Command aliases are searchable.
- Command descriptions are searchable.
- Usage details are shown in the side information area while browsing.
choosegenerates prompts from the selected command's native Symfony input definition instead of prompting for Artisan's global flags.- Raw extra input is appended after the generated parameters, so it can handle edge cases or intentionally override prompted values.
Testing
composer test
License
MIT