lazerg / laravel-choices
Installs: 2 535
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 1
Forks: 1
Open Issues: 0
Requires
- php: ^8.0
- illuminate/console: ^6.0|^7.0|^8.0|^9.0|^10.0
- illuminate/database: ^6.0|^7.0|^8.0|^9.0|^10.0
- illuminate/support: ^6.0|^7.0|^8.0|^9.0|^10.0
README
Command Line choices
This package allows developers to create command line interfaces for asking questions with a several answers with autocompletion.
Installation
composer require lazerg/laravel-choices
Usage with seeder
use Lazerg\LaravelChoices\ChoicesForSeeders; class DatabaseSeeder extends Seeder { use ChoicesForSeeders; public function run() { $this // Possible answers for this choice is: NO, No, no // as second argument does not exist, will skip this step // if user select this choice ->askWithChoices('No') // Possible answers for this choice is: YES, Yes, yes // If user select this choice, callback on second argument will be run ->addChoice('Yes', fn() => $this->call(FakeDataSeeder::class)) // Second argument here is default answer, // if user press enter without answering ->ask('Run FakeDataSeeder?', 'No'); } }