zozlak / argparse
A humble PHP clone of Python's argparse library
Installs: 4 224
Dependents: 6
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/zozlak/argparse
Requires
- php: >=8.0
Requires (Dev)
README
A humble PHP clone of Python's argparse.
Used to reduce my cognitive workload when switching between Python and PHP.
Implements only primary set of argparse features (see below) but strictly follows Python's argparse behavior.
API documentation
See the argparse docs with the following remarks:
- ArgumentParser constructor
supports only prog,description,epilogandexit-on-errorparameters.- Argument abbreviations are not implement.
 
- Almost all features of the add_argument() method are implemented.
 Known discrepancies include:- If you want to define many names for a given argument, pass them as an array to the nameparameter (it's impossible to implement it in PHP in exactly the same way it works in Python as PHP handles positional/named parameters in a slightly different way).
- Lack of support for %(prog)splaceholder in thehelpparameter.
- Lack of support for metavarparameter being an array.
 
- If you want to define many names for a given argument, pass them as an array to the 
- All features described under other utilities are not implemented.