1. Go to this page and download the library: Download docopt/docopt 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/ */
ort form, simple API
$args = Docopt::handle($doc);
// short form (5.4 or better)
$args = (new \Docopt\Handler)->handle($sdoc);
// long form, simple API (equivalent to short)
$params = array(
'argv'=>array_slice($_SERVER['argv'], 1),
'help'=>true,
'version'=>null,
'optionsFirst'=>false,
);
$args = Docopt::handle($doc, $params);
// long form, full API
$handler = new \Docopt\Handler(array(
'help'=>true,
'optionsFirst'=>false,
));
$handler->handle($doc, $argv)
$doc = <<<DOC
Usage: my_program.php [-hso FILE] [--quiet | --verbose] [INPUT ...]
Options:
-h --help show this
-s --sorted sorted output
-o FILE specify output file [default: ./test.txt]
--quiet print less text
--verbose print more text
DOC
$doc = <<<DOC
Usage: my_program.php [-hso FILE] [--quiet | --verbose] [INPUT ...]
-h --help show this
-s --sorted sorted output
-o FILE specify output file [default: ./test.txt]
--quiet print less text
--verbose print more text
DOC