Recommend this page to a friend! |
Download |
Info | Documentation | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2024-01-10 (8 months ago) | 52% | Total: 250 | All time: 7,923 This week: 47 |
Version | License | PHP version | Categories | |||
console-args 1.0.11 | MIT/X Consortium ... | 5.3 | PHP 5, Console |
Description | Author | |
This class can read and parse arguments for command line scripts. |
This is an wrapper for the argv global
The difference between arguments and options are:
* arguments are strings like `
--help`
* options are strings like `
--file=filename`
* other arguments without `
--`
are not recognized because the magic of this wrapper is that doesn't matter the order of the arguments/options
1.0.0
Add the module by composer.json, adding in require clause:
{
"jlaso/console-args": "1.0.0"
}
$consoleArgs = new ConsoleArgs($argv, array('help'), array('arg1', 'arg2'));
if($consoleArgs->hasHelp){
print <<<EOD
Please, use this arguments to invoke this command:
--help \tto see this help
--arg1=filename \tthe first argument
--arg2=filename\toptional, the second argument
EOD;
exit();
}
$arg1 = $consoleArgs->getArg1;
$arg2 = $consoleArgs->getArg2;
MIT
Files (5) |
File | Role | Description |
---|---|---|
composer.json | Data | Auxiliary data |
ConsoleArgs.php | Class | Class source |
LICENSE | Lic. | License text |
README.md | Doc. | Documentation |
VERSION | Data | Documentation |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
User Ratings | User Comments (1) | ||||||||||||||||||||||||||||||||||
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.