packfire/options
最新稳定版本:1.1.2
Composer 安装命令:
composer require packfire/options
包简介
Better CLI argument processing in PHP
README 文档
README
#Packfire Options
Better CLI argument processing in PHP
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.
##Requirements
-
= PHP 5.3
##Installation
To install Packfire Options, add the entry to your composer.json "require" section:
"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.
统计信息
- 总下载量: 967
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2012-12-06