A PHP library for command-line argument processing with support for short/long options, operands, validation, and help generation.
GetOpt.PHP is a PHP library designed for parsing and processing command-line arguments in scripts and applications. It solves the problem of handling complex argument structures, such as short/long options, operands, and validation, providing a standardized way to build command-line interfaces.
PHP developers building command-line tools, scripts, or applications that require robust argument parsing, such as CLI utilities, automation scripts, or console-based services.
Developers choose GetOpt.PHP for its comprehensive feature set, including support for multiple argument notations, collapsed options, operand handling, and built-in help generation, all while maintaining a simple and flexible API.
A PHP library for command-line argument processing
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports multiple styles such as --option value, --option=value, -o value, and -ovalue, accommodating diverse CLI conventions as highlighted in the features list.
Provides specification, validation, and limits for positional arguments, ensuring reliable processing of operands without manual checks.
Generates help text automatically based on defined options and commands, saving development time and improving user experience.
Includes argument validation and default values, reducing error-prone manual validation code, as noted in the features.
Version 3 introduced breaking changes requiring code adjustments, as mentioned in the upgrade guide, which can be a barrier for existing users.
Defining options and operands programmatically can be verbose compared to configuration-based libraries, adding boilerplate for simple setups.
Focuses on low-level parsing; lacks built-in features for common CLI patterns like interactive prompts or advanced subcommand management without extra work.