CLI
POSIX-style argument parser. Long options, short bundles, inline values, positional args — one static call.
composer require wp-php-toolkit/cli
Real CLI tools in PHP usually mean either pulling in symfony/console (and the transitive dependencies that come with it) or hand-rolling argv parsing that breaks the first time someone writes -vvv or --port=8080. The toolkit's CLI class is one static method, no dependencies, and handles the POSIX shapes you actually see.
Parse a single flag
The smallest useful invocation: one boolean flag, one positional. Each option is a four-tuple of [ short, has_value, default, description ].
Mix values, flags, and bundles
The parser accepts --port 8080, --port=8080, -p 8080, and -p=8080. It also expands bundled boolean shorts such as -afv.
Validate required options
The parser fills in defaults but never enforces "required". Check for null after parsing — full control over the error message.
Generate --help from definitions
Because each option carries its own description, you can render help text by walking the same definitions you parse with. No second source of truth.
Git-style subcommands
To build a tool with subcommands like mytool deploy, peel the first positional off argv, dispatch, and parse the rest with a per-command option set.