vendimia / clap
Command-line argument parser
Installs: 10
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/vendimia/clap
Requires
- php: >=8.1
- ext-mbstring: *
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