PHP code example of donatj / flags

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

    

donatj / flags example snippets




s = new donatj\Flags();

$foo     = & $flags->bool('foo', false, 'Enable the foo');
$bar     = & $flags->uint('bar', 10, 'Number of bars');
$baz     = & $flags->string('baz', 'default', 'What to name the baz');
$verbose = & $flags->short('v', 'verbosity');

/**
 * No Default value, making qux is *

function __construct(?array $args = null, $skipFirstArgument = true)

function arg($index)

function args()

function shorts()

function longs()

function short($letter, $usage = '')

function bool($name, $value = null, $usage = '')

function float($name, $value = null, $usage = '')

function int($name, $value = null, $usage = '')

function uint($name, $value = null, $usage = '')

function string($name, $value = null, $usage = '')

function getDefaults()

function parse(
	?array $args = null,
	$ignoreExceptions = false,
	$skipFirstArgument = null,
)

function parsed()