Last Updated: February 25, 2016
·
197
· fpisa

Simple class to wrap getopt()

I've coded a simple class to make use of getopt() PHP function.

Simple usage:

$options = new SimpleOpt($shortopts, $longopts);

 // dies if not provided
$required = $options->getRequiredOption('r');

 // if '-o' option is not given, returns 'default'
$optional = $options->getOption('o', 'default');

Source at GitHub.