Redbox PHP CLI Arguments: Extract command line parameter values

Recommend this page to a friend!
  Info   View files Example   View files View files (27)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2021-05-18 (3 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 88 All time: 9,638 This week: 271Up
Version License PHP version Categories
redbox-cli 1.2MIT/X Consortium ...5.4.0PHP 5, Console
Description Author

This class can extract command line parameter values.

It takes as parameters a list of types of arguments that the command line script expects including the the short and long name of the parameter, the description, and whether it is required.

If the parameters do not satisfy the requirements, the class throws an except that may be caught and used to show the expected usage of the command script to the user.

Picture of Johnny Mast
  Performance   Level  
Name: Johnny Mast <contact>
Classes: 10 packages by
Country: The Netherlands The Netherlands
Innovation award
Innovation award
Nominee: 5x

Details

redbox-logo-klein

Build Status Scrutinizer Code Quality Code Coverage Twitter URL

redbox-cli

This is a command line parser based on Climate by Joe Tannenbaum. We share a lot of similarities but i desided to take the getopt route and downgrade the number of lines in the code by 1/4 of the original size.

Howto use the package

Look in the examples folder for basic examples of how to use the package.

Installation

Using composer:

$ composer require redbox-cli

Requirements

The following versions of PHP are supported by this version.

  • PHP >= 7.3

Unit Testing

With the new 1.2 release we increased the test ratio from 64% in previous versions to 95% and that is making me proud. Also with the new release i have found a way to unit test the core component of this package (getopt(). While doing this we can make sure your implementation of Redbox-cli will run like a sunshine with any of your projects. If you want a little of what our new tests cover that was not possible before, checkout our examples directory for some great examples on how to use this great package.

Author

This package is created and maintained by Johnny Mast but it was based on Climate by Joe Tannenbaum. For feature requests and suggestions you could consider sending me an e-mail or fill out an issue.

License

Redbox-cli is released under the MIT public license.

LICENSE

  Files folder image Files  
File Role Description
Files folder image.github (1 directory)
Files folder imageexamples (4 files)
Files folder imagesrc (1 file, 2 directories)
Files folder imagetests (3 files, 1 directory)
Accessible without login Plain text file .gitignore Data Auxiliary data
Accessible without login Plain text file .scrutinizer.yml Data Auxiliary data
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file CONTRIBUTING.md Data NEW
Accessible without login Plain text file LICENSE.md Data Auxiliary data
Accessible without login Plain text file phpcs.xml.dist Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Data Auxiliary data

  Files folder image Files  /  .github  
File Role Description
Files folder imageworkflows (2 files)

  Files folder image Files  /  .github  /  workflows  
File Role Description
  Accessible without login Plain text file Php.yml Data Auxiliary data
  Accessible without login Plain text file Phpcs.yaml Data Auxiliary data

  Files folder image Files  /  examples  
File Role Description
  Accessible without login Plain text file autoload.php Aux. NEW
  Accessible without login Plain text file basic.php Example Example script
  Accessible without login Plain text file defaultvalue.php Example Example script
  Accessible without login Plain text file hasdefaultvalue.php Example Example script

  Files folder image Files  /  src  
File Role Description
Files folder imageArguments (4 files)
Files folder imageObject (1 file)
  Plain text file Cli.php Class Class source

  Files folder image Files  /  src  /  Arguments  
File Role Description
  Plain text file Argument.php Class Class source
  Plain text file Filter.php Class Class source
  Plain text file Manager.php Class Class source
  Plain text file Parser.php Class Class source

  Files folder image Files  /  src  /  Object  
File Role Description
  Plain text file ArgumentObject.php Class Class source

  Files folder image Files  /  tests  
File Role Description
Files folder imagemisc (2 files)
  Accessible without login Plain text file ArgumentObjectTest.php Test NEW
  Accessible without login Plain text file ArgumentsTest.php Test Unit test script
  Accessible without login Plain text file ManagerTest.php Test Unit test script

  Files folder image Files  /  tests  /  misc  
File Role Description
  Accessible without login Plain text file bootstrap.php Aux. Auxiliary script
  Plain text file overwriteGetOpt.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:88
This week:0
All time:9,638
This week:271Up
For more information send a message to info at phpclasses dot org.