PHP code example of vtardia / cli-parser

1. Go to this page and download the library: Download vtardia/cli-parser 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/ */

    

vtardia / cli-parser example snippets


$shortOptions = 'vho:a';

$longOptions = array(
    array('id', TRUE),
    array('name', TRUE),
    array('verbose', FALSE, 'v'),
    array('output', TRUE, 'o'),
);

// se CLIParser\CliParser;

// Define some options
$shortOptions = 'vo:';
$longOptions = array(
    array('verbose', false, 'v'),
    array('output', true, 'o'),
);

// Create a parser...
$cli = new CLIParser($shortOptions, $longOptions);

// ... and use it!

// Executable name or path
$program = $cli->program();

// Array of valid options with values
$options = $cli->options();

// Array of arguments
$arguments = $cli->arguments();