Skip to content

Instantly share code, notes, and snippets.

@eS-IT
Created June 13, 2020 15:08
Show Gist options
  • Save eS-IT/f5765566c2ed760eef9c6c575d70e032 to your computer and use it in GitHub Desktop.
Save eS-IT/f5765566c2ed760eef9c6c575d70e032 to your computer and use it in GitHub Desktop.
<?php
$this->io->ask('What is your name?');
// default value:
$this->io->ask('Where are you from?', 'United States');
// validation:
$this->io->ask('Number of workers to start', 1, function ($number) {
if (!is_numeric($number)) {
throw new \RuntimeException('You must type a number.');
}
return (int) $number;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment