Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore.

15 St Margarets, NY 10033
(+381) 11 123 4567



Laravel Console Wizard – Laravel News

Laravel Console WIzzard is a package for creating multi-step wizards with complex input inside the console. Its primary purpose is to collect data for file generators—here’s an example from the project’s readme:

namespace AppConsoleCommands;

use ShomishaLaravelConsoleWizardCommandWizard;
use ShomishaLaravelConsoleWizardStepsChoiceStep;
use ShomishaLaravelConsoleWizardStepsTextStep;

class IntroductionWizard extends Wizard
    protected $signature = "wizard:introduction";

    protected $description = 'Introduction wizard.';

    public function getSteps(): array
        return [
            'name'   => new TextStep("What's your name?"),
            'age'    => new TextStep("How old are you?"),
            'gender' => new ChoiceStep("Your gender?", ["Male", "Female"]),

    public function completed()
            "This is %s and %s is %s years old.",
            ($this->answers->get('gender') === 'Male') ? 'he' : 'she',

This package works by defining a set of steps and then once completed, you can process data for output, generate files, or perform whatever you need to with the data.

  • TextStep – expects a text input answer (i.e., name)
  • MultipleAnswerTextStep – similar to TextStep, except it takes multiple answers and returns them in an array
  • ChoiceStep – this allows a user to pick one answer from multiple choices
  • MultipleChoiceStep – similar to ChoiceStep, but allows the user to pick multiple choices and returns the values as an array
  • UniqueMultipleChoiceStep – just like MultipleChoiceStep, but does not allow a user to select a single choice more than once
  • ConfirmStep – the user confirms yes or no, and this step returns a Boolean.

Learn More

You can learn more about this package, get full installation instructions, and view the source code on GitHub. This package also has a wiki providing in-depth documentation on step types, validation, and using the package.

Filed in:

Credit: Source link

Previous Next
Test Caption
Test Description goes like this