|
18 | 18 | > 使用方便简单。可以方便的整合到任何已有项目中。 |
19 | 19 |
|
20 | 20 | - 命令行应用, 命令行的 `controller`, `command` 解析运行 |
21 | | -- 支持给命令设置别名,一个命令可以有多个别名。支持命令的显示/隐藏,启用/禁用 |
22 | | -- 功能全面的命令行的选项参数解析(命名参数,短选项 `-s`,长选项 `--long`) |
23 | | -- 命令行下的 输入`input`, 输出 `output` 管理、使用 |
24 | | -- 命令方法注释自动解析为帮助信息(默认提取 `@usage` `@arguments` `@options` `@example` 等信息) |
| 21 | +- 支持给命令设置别名,一个命令可以有多个别名。 |
| 22 | + - 支持命令的显示/隐藏,启用/禁用 |
| 23 | +- 命令行下的 输入`input`, 输出 `output`, Flag解析管理、使用 |
| 24 | +- 功能全面的命令行的选项、参数解析 |
| 25 | + - 命名参数,数组参数 |
| 26 | + - 选项绑定 短选项 `-s`,长选项 `--long` |
| 27 | + - 支持定义数据类型(`bool,int,string,array`),解析后会自动格式化输入值 |
| 28 | +- 命令方法注释自动解析为帮助信息 |
| 29 | + - 默认提取 `@usage` `@arguments` `@options` `@example` 等信息 |
| 30 | + - **NEW** v4 版本支持从注释定义选项参数的数据类型 |
| 31 | +- 支持注册事件监听,错误处理等 |
| 32 | + |
| 33 | +### 更多特性 |
| 34 | + |
25 | 35 | - 支持输出多种颜色风格的消息文本(`info`, `comment`, `success`, `warning`, `danger`, `error` ... ) |
26 | 36 | - 常用的特殊格式信息显示(`section`, `panel`, `padding`, `helpPanel`, `table`, `tree`, `title`, `list`, `multiList`) |
27 | 37 | - 丰富的动态信息显示(`pending/loading`, `pointing`, `spinner`, `counterTxt`, `dynamicText`, `progressTxt`, `progressBar`) |
|
43 | 53 |
|
44 | 54 | ## 快速安装 |
45 | 55 |
|
| 56 | +- Requirement php 7.3+ |
| 57 | + |
46 | 58 | ```bash |
47 | 59 | composer require inhere/console |
48 | 60 | ``` |
49 | 61 |
|
| 62 | +## 快速开始 |
| 63 | + |
| 64 | +```php |
| 65 | +// file: examples/app |
| 66 | +use Inhere\Console\IO\Input; |
| 67 | +use Inhere\Console\IO\Output; |
| 68 | + |
| 69 | +$meta = [ |
| 70 | + 'name' => 'My Console App', |
| 71 | + 'version' => '1.0.2', |
| 72 | +]; |
| 73 | + |
| 74 | +// 通常无需传入 $input $output ,会自动创建 |
| 75 | +// $app = new \Inhere\Console\Application($meta, $input, $output); |
| 76 | +$app = new \Inhere\Console\Application($meta); |
| 77 | + |
| 78 | +// 注册命令 |
| 79 | +$app->command(DemoCommand::class); |
| 80 | +// 注册命令组 |
| 81 | +$app->addGroup(MyController::class); |
| 82 | +// ... ... |
| 83 | + |
| 84 | +// run |
| 85 | +$app->run(); |
| 86 | +``` |
| 87 | + |
50 | 88 | ## 文档列表 |
51 | 89 |
|
52 | | -> 请到WIKI查看详细的使用文档 |
| 90 | +请到[WIKI](https://github.com/inhere/php-console/wiki)查看更多详细的使用文档 |
| 91 | + |
| 92 | + |
53 | 93 |
|
54 | 94 | - **[文档首页](https://github.com/inhere/php-console/wiki/home)** |
55 | 95 | - **[功能概览](https://github.com/inhere/php-console/wiki/overview)** |
@@ -98,12 +138,18 @@ $ php examples/app --debug 4 |
98 | 138 | - [kite](https://github.com/inhere/kite) PHP编写的,方便本地开发和使用的个人CLI工具应用 |
99 | 139 | - More, please see [github used by](https://github.com/inhere/php-console/network/dependents?package_id=UGFja2FnZS01NDI5NzMxOTI%3D) |
100 | 140 |
|
101 | | -## License |
102 | | - |
103 | | -[MIT](LICENSE) |
104 | | - |
105 | 141 | ## 我的其他项目 |
106 | 142 |
|
107 | 143 | - [inhere/php-validate](https://github.com/inhere/php-validate) 一个简洁小巧且功能完善的php验证库 |
108 | 144 | - [inhere/sroute](https://github.com/inhere/php-srouter) 轻量且快速的HTTP请求路由库 |
109 | 145 |
|
| 146 | +## 依赖包 |
| 147 | + |
| 148 | +- [toolkit/cli-utils](https://github.com/php-toolkit/cli-utils) |
| 149 | +- [toolkit/pflag](https://github.com/php-toolkit/pflag) |
| 150 | +- [toolkit/stdlib](https://github.com/php-toolkit/stdlib) |
| 151 | +- [toolkit/sys-utils](https://github.com/php-toolkit/sys-utils) |
| 152 | + |
| 153 | +## License |
| 154 | + |
| 155 | +[MIT](LICENSE) |
0 commit comments