cliphp / args
Command line arguments
1.0.4
2018-07-06 17:23 UTC
Requires
- php: >=7.1
Requires (Dev)
- phpunit/phpunit: ^6.1
- squizlabs/php_codesniffer: 2.*
This package is auto-updated.
Last update: 2026-03-12 22:56:37 UTC
README
Library for command line arguments.
use Cliphp; $args = new Args; // Check for --help flag if ($args->has('help')) { // show help message } // Get limit value $limit = $args->get('limit') ?? 100;
Notes
The global $argv variable returns the script name (e.g. index.php) as the first value in
the array. This library will shift the script name from the arguments list.
Available Methods
get(string $arg): mixed|nullReturns value of an argument orNULLif it doesn't exist.has(string $arg): boolChecks for existence of an argumentall(): arrayGet all of the argumentscount(): intGet count of arguments