vendimia/clap

Command-line argument parser

Maintainers

Details

github.com/vendimia/clap

Source

Issues

Installs: 10

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/vendimia/clap

0.3 2025-07-30 01:22 UTC

This package is auto-updated.

Last update: 2025-09-30 03:04:18 UTC


README

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