vanengers/symfony-console-command-lib
最新稳定版本:v1.3.1
Composer 安装命令:
composer require vanengers/symfony-console-command-lib
包简介
Symfony Console Command library
README 文档
README
Library for Symfony console commands
Installation
composer require vanengers/symfony-console-command-lib
Usage
class MyCommand extends AbstractConsoleCommand {}
Implement the abstract methods and you are good to go.
executeCommand():
the method that actually executes the command, do not use the execute() method from the parent class
getCommandName():
this should return the name of the command for the command line
getCommandDescription():
this should return a description of the command for the command line
getOptions():
this should return an array of options for the command line Each Option will be checked for default value and value inputed by the user Look at the example
only simple types are expected: array, bool, int, string
All options are input as options and not arguments. So all options could be defaulted.
You could implicitly require an input by setting the default value to null and setting the required flag to true
Validators
You can add validators to the Option in getOptions
new Option('config', 'name param', 'string', null, true, null, [ new FileExistsValidator(), ])
By setting default value to null and required to true, you can require a file that exists. Settting up validators is easy, just create a class that implements the IParamValidate interface and add it to the option.
统计信息
- 总下载量: 27
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-01-01