PHP code example of mateodioev / php-easy-cli

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

    

mateodioev / php-easy-cli example snippets


use Mateodioev\PhpEasyCli\{App, Color, Context, Printer};

$app = new App($argv);

$app->register('help', function(Context $ctx, Printer $printer) {
    $printer->display('Default command is help!!');
});

$app->register('hello', function(Context $ctx, Printer $printer) {
    $printer->display('Hello ' . $ctx->get('name', true, 'User name'));
});

$app->run();
bash
composer 
bash
php script.php hello --name=Mateo