PHP code example of chinayin / think-command

1. Go to this page and download the library: Download chinayin/think-command library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

chinayin / think-command example snippets


protected function buildCommandDefinition(){
  return [
    new Argument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
    new Option('raw', null, InputOption::VALUE_NONE, 'To output raw command list')
  ];
}

protected function main(Input $input, Output $output){

}

* @param string  $message_id   消息ID
* @param array   $json         解析后的json数据
* @param         $message      原始消息
* @param int     $workerId     所进程进程索引ID
protected function consume(string $message_id, array $json, $message, int $workerId = 0);

* @param string  $message_id  消息ID
* @param array   $json        解析后的json数据
* @param array   $properties  消息属性
* @param         $message     原始消息
* @param int     $workerId    所进程进程索引ID
protected function consume(string $message_id, array $json, $message, array $properties, int $workerId = 0);