PHP code example of celemas / cli

1. Go to this page and download the library: Download celemas/cli 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/ */

    

celemas / cli example snippets


use Celemas\Cli\Command;

class MyCommand extends Command {
    protected string $name = 'mycommand';
    protected string $group = 'MyGroup';
    protected string $description = 'This is my command';

    public function run(): int
    {
        $this->info("Running my command");
        $this->success("Command completed!");
        return 0;
    }
}


Celemas\Cli\{Runner, Commands};

$commands = new Commands([new MyCommand()]);
$runner = new Runner($commands);
$runner->run();