TIP 03 / 12

Artisan Command Parameters.

When creating Artisan command, you can ask the input in variety of ways: $this->confirm(), $this->anticipate(), $this->choice().

code
// Prompt for a yes-or-no response.
if ($this->confirm('Do you wish to continue?')) {
    //
}

// Prompt with autocomplete options.
$name = $this->anticipate('What is your name?', ['Taylor', 'Dayle']);

// Select an option by its default index.
$name = $this->choice('What is your name?', ['Taylor', 'Dayle'], $defaultIndex);