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

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

chency147/cli-message
=====================

A tool to make the output of command line colorful.

0.1.1(7y ago)17965MITPHPPHP &gt;=5.4.0

Since Aug 26Pushed 5y ago5 watchersCompare

[ Source](https://github.com/chency147/cli-message)[ Packagist](https://packagist.org/packages/chency147/cli-message)[ RSS](/packages/chency147-cli-message/feed)WikiDiscussions master Synced today

READMEChangelog (1)DependenciesVersions (4)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 "chency147/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

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 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 ~1 days

Total

2

Last Release

2863d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13692301?v=4)[Rick Chen](/maintainers/chency147)[@chency147](https://github.com/chency147)

---

Top Contributors

[![chency147](https://avatars.githubusercontent.com/u/13692301?v=4)](https://github.com/chency147 "chency147 (6 commits)")

### Embed Badge

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

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

###  Alternatives

[seld/cli-prompt

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

24726.4M22](/packages/seld-cli-prompt)[illuminate/console

The Illuminate Console package.

13045.3M6.2k](/packages/illuminate-console)[styleci/cli

The CLI tool for StyleCI

71464.1k9](/packages/styleci-cli)[winbox/args

Windows command-line formatter

20718.9k21](/packages/winbox-args)

PHPackages © 2026

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