1. Go to this page and download the library: Download tomwright/commander 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/ */
tomwright / commander example snippets
namespace App\Commanding\Command;
class RegisterUserCommand extends \TomWright\Commander\Command\Command
{
protected $username;
protected $password;
public function setUsername($username)
{
$this->username = $username;
}
public function getUsername()
{
return $this->username;
}
public function setPassword($password)
{
$this->password = $password;
}
public function getPassword()
{
return $this->password;
}
}
namespace App\Commanding\Handler;
class RegisterUserHandler implements \TomWright\Commander\Handler\HandlerInterface
{
public function handle(\TomWright\Commander\Command\CommandInterface $command)
{
echo "Registering user \"{$command->getUsername()}\" with password \"{$command->getPassword()}\".";
}
}