webtrendi/clapp
Composer 安装命令:
composer require webtrendi/clapp
包简介
Parses command line arguments passed to a PHP script
README 文档
README
Parses command line arguments passed to a PHP script.
Usage
// Define accepted arguments $definitions = new \Clapp\CommandLineArgumentDefinition(array( "help|h" => "Shows help message", "message|m=s" => "Input message", "verbose|v+" => "Set level of verbose output", )); // Filter arguments based and validate according to definitions $filter = new \Clapp\CommandArgumentFilter($definitions, $argv); // Retrieve parameter if set if ($filter->getParam('h') !== false) { echo $definitions->getUsage(); exit(); } //if
Features
- Simple definition syntax
- Supports long and short arugment names (-v --verbose)
- Supports repeated arguments (--name=bob --name=mary)
- Supports multiple short arguments (-abc equivalent of -a -b -c)
- Supports 2 ways of setting values (--name=bob or --name bob)
- Supports double dash delimiter for trailing values
- Creates detailed usage documentation using definitions
统计信息
- 总下载量: 277
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 0
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-04-07