1. Go to this page and download the library: Download yeriomin/getopt library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
yeriomin / getopt example snippets
pt = new \Yeriomin\Getopt\Getopt();
$arguments = $getopt->getArguments();
$optionDefinition = new \Yeriomin\Getopt\OptionDefinition(
'c',
'config',
'Path to a configuration file'
);
$getopt->addOptionDefinition($optionDefinition);
$optionDefinition = new \Yeriomin\Getopt\OptionDefinition(
'c',
'config',
'Path to a configuration file',
true
);
$getopt->addOptionDefinition($optionDefinition);
pt = new \Yeriomin\Getopt\Getopt();
$optionConfig = new \Yeriomin\Getopt\OptionDefinition(
'c',
'config',
'Path to a configuration file',
true
);
$getopt->addOptionDefinition($optionConfig);
$optionHelp = new \Yeriomin\Getopt\OptionDefinition(
'h',
'help',
'Show script help message',
);
$getopt->addOptionDefinition($optionHelp);
try {
$configPath = $getopt->c;
} catch (\Yeriomin\Getopt\GetoptException $e) {
echo $e->getMessage() . "\n";
echo $getopt->getUsageMessage();
exit(1);
}
array(1) {
'option1' =>
string(6) "value1"
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.