2017 © Pedro Peláez
 

library options

Better CLI argument processing in PHP

image

packfire/options

Better CLI argument processing in PHP

  • Wednesday, June 5, 2013
  • by mauris
  • Repository
  • 1 Watchers
  • 2 Stars
  • 941 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Packfire Options

Better CLI argument processing in PHP, (*1)

Options helps you to parse CLI arguments using callbacks and Closures (in PHP 5.3+) effectively. Implementing the NDesk.Options (C#) in PHP, you will be able to write neat CLI applications in PHP quickly., (*2)

Requirements

  • >= PHP 5.3

Installation

To install Packfire Options, add the entry to your composer.json "require" section:, (*3)

"packfire/options": "1.1.*"

Usage

use Packfire\Options\OptionSet;

$command = null;
$quiet = false;
$force = false;
$linker = false;
$file = '';

$options = new OptionSet();

$options->addIndex(0, function($value) use(&$command) {
            $command = $value;
        });
$options->add('q', function() use(&$quiet) {
            $quiet = true;
        });
$options->add('l', function() use(&$linker) {
            $linker = true;
        });
$options->add('f', function() use(&$force) {
            $force = true;
        });
$options->add('file=', function($value) use(&$file) {
            $file = $value;
        });

$options->parse($_SERVER['argv']);

Projects using Packfire Options

Contributors

  • Sam-Mauris Yong (@thephpdeveloper)

License

Packfire Options is licensed under the BSD 3-Clause License. See license file in repository for details., (*4)

The Versions

05/06 2013

dev-develop

dev-develop http://mauris.sg/packfire/

Better CLI argument processing in PHP

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

cli callback processing closure argument

24/12 2012

dev-master

9999999-dev http://mauris.sg/packfire/

Better CLI argument processing in PHP

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

cli callback processing closure argument

24/12 2012

1.1.2

1.1.2.0 http://mauris.sg/packfire/

Better CLI argument processing in PHP

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

cli callback processing closure argument

17/12 2012

1.1.0

1.1.0.0 http://mauris.sg/packfire/

Better CLI argument processing in PHP

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

cli callback processing closure argument

13/12 2012

1.0.1

1.0.1.0 http://mauris.sg/packfire/

Better CLI argument processing in PHP

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

cli callback processing closure argument

06/12 2012

1.0.0

1.0.0.0 http://mauris.sg/packfire/

Better CLI argument processing in PHP

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

cli callback processing closure argument