Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AlexNodex/c22085c137b4a8b84e580db298ac4656 to your computer and use it in GitHub Desktop.
Save AlexNodex/c22085c137b4a8b84e580db298ac4656 to your computer and use it in GitHub Desktop.
$event = $container->get('event');
$event->on('cli.commands',function($console){
// you can now bind a route to the console //
$console->command('users:add',function($arguments) {
//$arguments come from the command line like this...
// php run users:add --username="cannap" --password="dp"
// $arguments['username']=cannap;
// $arguments['password']="dp";
$users = $this->get('users'); // get a pre registered service container class under users
return $users->addUser($arguments);
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment