Basic command

  • No category
  • No parameter

To create your new command, you need to copy the command base.

<?php
 
namespace App\Commands;
 
use Bypc\Commander;
use Bypc\Core;
 
class Hello extends Commander {
    protected string $name = 'hello';
    protected string $description = 'Displays a greeting.';
 
    protected bool $paramRequired = false;
    protected bool $categoryRequired = false;
    protected array $categoriesTrusted = [];
 
    public function handler(Core $tool, string|null $param, string|null $category) {
        $this->checkRulers($param, $category);
 
        echo "Hello, world!\n";
    }
}
 
// php bypc.php hello