承接 d2g/reactor 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

d2g/reactor

Composer 安装命令:

composer require d2g/reactor

包简介

README 文档

README

#Command line micro-framework in php

why another cli tool ?

Because i did not find anything simple enough to use. This is, in my opinion, quiet simple and will handle most of the nee i can think of concerning cli.

Create your command line

extend reactor command class

class Mycommand extends \D2G\Reactor\Command

define your methods and required argument/options

function __construct($args, $opts, $flags)
{
    parent::construct($args, $opts, $flags);
    $this->commands = array(
        '<pre>__DEFAULT__</pre>'=>'__help',
        // the name of your method
        'my_method'=>array(
            // defining expected inputs 
            'expecting'=>array(
                // defining expected arguments
                'args'=>array(
                    array(
                        // used in error message
                        'name'=>'my-argument',
                        // internal function will try to cast the argument to this type
                        'type'=>'type of argument',
                        // command will fail if an expected argument is not present
                        'required'=>true|false
                    )
                ),
                // defining expected options
                'opts'=>array(
                    // option name used in cli prefixed with --
                    'option-name'=>array(
                        // internal function will try to cast the argument to this type
                        'type'=>'string',
                        // command will fail if an expected argument is not present
                        'required'=>true|false
                        // default value assigned to the options if not given
                        'default'=>''
                    )
                )
                // defining expected flags
                'args'=>array(
                    array(
                        // flags
                        'a',
                        'longflag'
                    )
                ),
            ),
        )
    );
}

Usage

Basic

on *nix

[php ][vendor/bin/]reactor Your/Command/Class/FQN/With/Slashes:yourCommandMethod firstArg secondArg --myOption=myOptionValue --myOtherOpt="value encapsed" -longFlag -a

统计信息

  • 总下载量: 47.81k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2017-06-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固