"Argh" is short for Argument Helper.
Interpret PHP command line arguments with ease so you can focus on your CLI application.
-
More about Argh at Argh! Argument Helper for PHP CLI
-
Detailed documentation in the Argh! Wiki
This project has been developed and tested with the following (see list below), and has yet to be tested using other operating systems or versions of PHP.
- PHP 7.2.14
- CentOS 7.6
There are two methods of installing Argh. Composer is recommended.
- Composer
- Phar (PHP Archive)
More detailed instructions can be found at Argh Installation Instructions
Composer is the preferred method for installation.
$ composer require netfocusinc/argh
$ php vendor/netfocusinc/argh/bin/argh.php about
Argh! by Benjamin Hough, Net Focus Inc. - https://www.netfocusinc.com/argh
Releases can be downloaded from Argh's Github Releases.
$ cd path/to/argh
$ php argh.phar about
Argh! by Benjamin Hough, Net Focus Inc. - https://www.netfocusinc.com/argh
Using Argh is an easy way to interpret command line arguments in your PHP CLI scripts.
When your PHP CLI script is invoked with command line arguments
$ php myprogram.php --message='Hello World!'
<?php
include 'vendor/autoload.php';
use netfocusinc\argh\Argh;
use netfocusinc\argh\StringParameter;
// Create a new Argh instance
$argh = new Argh(
[
StringParameter::createWithAttributes( [ 'name' => 'message' ] )
]
);
// Let Argh parse PHP's $argv array
$argh->parse($argv);
// Access run-time values of the arguments that were supplied to your CLI script
echo $argh->message; // Hello World!
See more examples of how to use Argh are available.
The PHPUnit tests for Argh can be run like this.
- When Argh is installed with Composer
$ vendor/bin/phpunit --bootstrap vendor/autoload.php --testdox tests/
- PHP - PHP is a popular general-purpose scripting language that is especially suited to web development.
- Composer - Dependency Manager for PHP
- PHPUnit - Testing Framework
- phar-composer - Simple phar creation for any project managed via composer.
This project uses Semantic Versioning
For the versions available, see the GitHub releases page.
A Changelog is also available on Github.
See the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details.