Skip to content

vendimia/clap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

vendimia/clap ๐Ÿ‘

PHP command-line argument parser.

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();

Calling this script will execute function createUser() with the first CLI argument as $username. If '--admin' argument is passed to the script, it will pass true to $admin.

php createuser.php john

About

Command-line argument parser

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages