PHP code example of hcesrl / laravel-wizartisan
1. Go to this page and download the library: Download hcesrl/laravel-wizartisan 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/ */
hcesrl / laravel-wizartisan example snippets
namespace App\Console\Commands;
use Wizartisan\Command;
class CustomCommand extends Command
{
protected function configureWizard ()
{
/**
* Ask simple question with validation
*/
$this->askQuestion ( 'What is your name?' )
->name ( 'name' )
->mustValidate ( ' ]
);
/**
* Ask a question with confirmation and hide the answer
*/
$this->askQuestion ( 'What is your secret password?' )
->name ( 'password' )
->hideAnswer ()
->withConfirmation ( 'You must confirm your password' );
}
protected function finish ( $data = [] )
{
$this->doSomethingWithTheValidInputData ( $data );
return 0;
}
}