PHP code example of gnugat / konzolo

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

    

gnugat / konzolo example snippets




namespace Acme\Demo\Command;

use Gnugat\Konzolo\Command;
use Gnugat\Konzolo\Input;

class HelloWorldCommand implements Command
{
    public function execute(Input $input)
    {
        $name = $input->getArgument('name');
        echo "Hello $name\n";

        return Command::EXIT_SUCCESS;
    }
}



cme\Demo\Command\HelloWorldCommand;
use Gnugat\Konzolo\Application;
use Gnugat\Konzolo\Input;

$input = new Input('hello:world');
$input->setArgument('name', $argv[1]);

$app = new Application();
$app->addCommand('hello:world', new HelloWorldCommand());
$exitCode = $app->run($input)

exit($exitCode);