PHP code example of stdakov / terminal-request

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

    

stdakov / terminal-request example snippets





$terminal = new Terminal\Request();

echo "Script:" . $terminal->getScript() . PHP_EOL;
echo "Command:" . $terminal->getCommand() . PHP_EOL;
echo "SubCommand:" . $terminal->getSubCommand() . PHP_EOL;
foreach ($terminal->getParams() as $paramName => $paramValue) {
    echo "Param $paramName has value '" . ($terminal->getParameter($paramName) === true ? "true" : $terminal->getParameter($paramName)) . "'" . PHP_EOL;
}

print_r($terminal->getParams());
bash
php script.php command subCommand -a value1 -bc 'value2' --param1 value3 --param2 --pa "value4" --vk value5