PHPackages                             guirong/cli-message - 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. guirong/cli-message

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

guirong/cli-message
===================

A tool to make the output of command line colorful

1.0.5(3y ago)0371MITPHPPHP &gt;=5.4.0

Since Feb 22Pushed 3y ago1 watchersCompare

[ Source](https://github.com/GuiRong2969/cli-message)[ Packagist](https://packagist.org/packages/guirong/cli-message)[ RSS](/packages/guirong-cli-message/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (7)Used By (0)

Cli Message
===========

[](#cli-message)

Let your php output in command line colorful.

效果预览
----

[](#效果预览)

[![样例](./image/demo.gif)](./image/demo.gif)[![支持的颜色](./image/supportColors.jpg)](./image/supportColors.jpg)

要求
--

[](#要求)

- PHP &gt;= 5.4

使用方法
----

[](#使用方法)

### 安装

[](#安装)

`composer require "guirong/cli-message"`

### 使用示例

[](#使用示例)

```
$style = new Style();
$style->setForegroundColor(Style::COLOR_GREEN) // 定义颜色为绿色
      ->setBold() // 设置加粗
      ->setUnderLine(); // 设置显示下划线
$message = new Message();
$message->setStyle($style); // 给消息设定样式
$message->setContent('哈哈哈！'); // 设置消息内容
echo $message, PHP_EOL; // 重写了__toString方法，消息对象可直接作为字符串使用

// 也可以用getContentWithStyle方法来获取处理后的字符串进行输出
echo $message->getContentWithStyle(), PHP_EOL;

$anotherStyle = new Style();
$anotherStyle->setForegroundColor(Style::COLOR_RED);
echo $message->getContentWithStyle($anotherStyle, PHP_EOL);
```

### 颜色说明

[](#颜色说明)

- 颜色由0到255的整数来控制，可参照效果预览中的颜色表来选择自己所需的颜色；

协议
--

[](#协议)

本项目使用MIT协议。

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.5% 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 ~17 days

Total

6

Last Release

1095d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d1527d9f9a4c290eb6f9512346ff4323b99a79611e91d226aa9c37789cfe4890?d=identicon)[guirong](/maintainers/guirong)

---

Top Contributors

[![GuiRongSir](https://avatars.githubusercontent.com/u/170094007?v=4)](https://github.com/GuiRongSir "GuiRongSir (7 commits)")[![GuiRong2969](https://avatars.githubusercontent.com/u/40567721?v=4)](https://github.com/GuiRong2969 "GuiRong2969 (1 commits)")

### Embed Badge

![Health badge](/badges/guirong-cli-message/health.svg)

```
[![Health](https://phpackages.com/badges/guirong-cli-message/health.svg)](https://phpackages.com/packages/guirong-cli-message)
```

###  Alternatives

[wp-cli/wp-cli

WP-CLI framework

5.0k17.2M320](/packages/wp-cli-wp-cli)[consolidation/annotated-command

Initialize Symfony Console commands from annotated command class methods.

22569.8M19](/packages/consolidation-annotated-command)[chi-teck/drupal-code-generator

Drupal code generator

26947.8M5](/packages/chi-teck-drupal-code-generator)[seld/cli-prompt

Allows you to prompt for user input on the command line, and optionally hide the characters they type

24725.8M17](/packages/seld-cli-prompt)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[php-tui/php-tui

Comprehensive TUI library heavily influenced by Ratatui

589747.0k6](/packages/php-tui-php-tui)

PHPackages © 2026

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