gobwas/shellstyle

ShellStyle 是一个简单的 PHP 类,允许您使用 ANSI 转义码获取包装的 Unix/Linux 彩色输出

1.0.0-alpha.1 2013-01-08 13:31 UTC

This package is not auto-updated.

Last update: 2024-09-28 12:58:44 UTC


README

ShellStyle

ShellStyle 是一个简单的 PHP 类,允许您使用 ANSI 转义码获取包装的 Unix/Linux 彩色输出

用法

ShellStyle 的用法非常简单

use Gobwas\ShellStyle\ShellStyle;

// First way to define style
$green = new ShellStyle();
$green
    ->addStyle(ShellStyle::FOREGROUND_GREEN)
    ->addStyle(ShellStyle::STYLE_BOLD);

// Another way to define style
$yellow = new ShellStyle(array(ShellStyle::FOREGROUND_YELLOW));

echo $green->parse("Hello");
echo $yellow->parse("World!");