1. Go to this page and download the library: Download jawira/mini-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/ */
jawira / mini-getopt example snippets
// resources/example.php
// Preparing options
$mg = new \Jawira\MiniGetopt\MiniGetopt();
$mg->addRequired('f', 'format'); // value is verbose'); // no value
$mg->addNoValue('', 'version'); // only long option
// Calling getopt
var_export($mg->getopt());
// Setup
$mg = new \Jawira\MiniGetopt\MiniGetopt();
$mg->addRequired('f', 'format');
$mg->addNoValue('v', 'verbose');
// Calling getopt function with `optind` parameter
$optind = null;
$options = $mg->getopt($optind);
echo "optind: $optind" . PHP_EOL;