PHP code example of vendimia / clap

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

    

vendimia / clap example snippets


use Vendimia\Clap\Parser;

function createUser($username, bool $admin = false)
{
    if ($admin) {
        echo "Creating admin user {$username}...";
    } else {
        echo "Creating user {$username}...";
    }
}

$cli = new Parser;
$cli->register(createUser(...));

$cli->process();
bash
php createuser.php john