PHP code example of shomisha / laravel-console-wizard
1. Go to this page and download the library: Download shomisha/laravel-console-wizard library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
shomisha / laravel-console-wizard example snippets
namespace App\Console\Commands;
use Shomisha\LaravelConsoleWizard\Command\Wizard;
use Shomisha\LaravelConsoleWizard\Steps\ChoiceStep;
use Shomisha\LaravelConsoleWizard\Steps\TextStep;
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->line(sprintf(
"This is %s and %s is %s years old.",
$this->answers->get('name'),
($this->answers->get('gender') === 'Male') ? 'he' : 'she',
$this->answers->get('age')
));
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.