PHPackages                             chinayin/think-command - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. chinayin/think-command

ActiveLibrary[CLI &amp; Console](/categories/cli)

chinayin/think-command
======================

thinkphp command library

v1.3.7(3y ago)02.4k↓42.9%1[1 PRs](https://github.com/chinayin/think-command/pulls)Apache-2.0PHPPHP &gt;=7.2

Since Sep 16Pushed 3y ago1 watchersCompare

[ Source](https://github.com/chinayin/think-command)[ Packagist](https://packagist.org/packages/chinayin/think-command)[ RSS](/packages/chinayin-think-command/feed)WikiDiscussions 1.3 Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (45)Used By (0)

think-command 定制版命令行
====================

[](#think-command-定制版命令行)

[![Author](https://camo.githubusercontent.com/c81fe059489a5ff135b4a16cb4193135426863c4e0f69d804fde4244b5d306eb/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f617574686f722d406368696e6179696e2d626c75652e737667)](https://github.com/chinayin)[![Software License](https://camo.githubusercontent.com/1a71f03cc9974f9d8ffd61fe4a80db97f4b1ce333478e07c6b7c85f44d804609/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4170616368652d2d322e302d627269676874677265656e2e737667)](LICENSE)[![Latest Version](https://camo.githubusercontent.com/830a2b01d5a5bf98799a198688a11e48f3b8ab83b1e5d059b9611899acef6968/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6368696e6179696e2f7468696e6b2d636f6d6d616e642e737667)](https://packagist.org/packages/chinayin/think-command)[![Build Status](https://camo.githubusercontent.com/b0ecbfb9ac006305b4aabd7d6b04470bd65b7fbc17a50de4644d29a7badf5567/68747470733a2f2f7472617669732d63692e6f72672f6368696e6179696e2f7468696e6b2d636f6d6d616e642e7376673f6272616e63683d302e34)](https://travis-ci.org/chinayin/think-command)[![Total Downloads](https://camo.githubusercontent.com/d0917e349975a629c9c6e4a3f60c83eb41ef8f4e0c6ac5d828e8f0211ef60f39/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6368696e6179696e2f7468696e6b2d636f6d6d616e642e737667)](https://packagist.org/packages/chinayin/think-command)[![php 7.2+](https://camo.githubusercontent.com/2376755214318dbed6b54c54d063cd49a92f9116f93a173fca1952d529376fd6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d6d696e253230372e322d7265642e737667)](https://camo.githubusercontent.com/2376755214318dbed6b54c54d063cd49a92f9116f93a173fca1952d529376fd6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d6d696e253230372e322d7265642e737667)

安装
--

[](#安装)

运行环境要求 PHP 7.2 及以上版本，以及 [thinkphp5](https://github.com/chinayin/thinkphp5)。

#### composer 安装

[](#composer-安装)

如果使用标准的包管理器 composer，你可以很容易的在项目中添加依赖并下载：

```
composer require chinayin/think-command
```

### 使用说明

[](#使用说明)

#### `ThinkCommand` 命令行程序

[](#thinkcommand-命令行程序)

- `ThinkCommand` 对thinkphp5中`Command`做了基础封装，可以更简单方便的开发命令行程序

    - 开启debug模式 `--debug` 程序中通过`IS_DEBUG_CONSOLE`来判断
    - 强制模式 `--force`
    - 配合swoole，进程数 `--thread`
- 命令行参数配置 `buildCommandDefinition()`

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

- 主入口 `main`

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

}
```

#### `ThinkMNSQueueV2Command` 阿里云Mns队列消费

[](#thinkmnsqueuev2command-阿里云mns队列消费)

- 消息消费 `consume`

```
* @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);
```

#### `ThinkMQQueueCommand` 阿里云MQ队列消费

[](#thinkmqqueuecommand-阿里云mq队列消费)

- 消息消费 `consume`

```
* @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);
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~24 days

Recently: every ~45 days

Total

44

Last Release

1399d ago

Major Versions

v0.4.8 → v1.0.02020-02-27

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10531946?v=4)[Leo](/maintainers/chinayin)[@chinayin](https://github.com/chinayin)

---

Top Contributors

[![chinayin](https://avatars.githubusercontent.com/u/10531946?v=4)](https://github.com/chinayin "chinayin (32 commits)")

---

Tags

sdklibrarythinkphp

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/chinayin-think-command/health.svg)

```
[![Health](https://phpackages.com/badges/chinayin-think-command/health.svg)](https://phpackages.com/packages/chinayin-think-command)
```

###  Alternatives

[ollyxar/php-malware-detector

PHP malware detector

12926.4k](/packages/ollyxar-php-malware-detector)[toolkit/cli-utils

useful cli tool library of the php

20222.1k16](/packages/toolkit-cli-utils)[eddiriarte/console-select

A fancy selection interface for symfony's console component.

117.2k2](/packages/eddiriarte-console-select)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
