gamu1012/cli-text-decoration

String decoration library for PHP CLI output

Maintainers

Package info

github.com/gamu1012/cli-text-decoration

Issues

pkg:composer/gamu1012/cli-text-decoration

Statistics

Installs: 910

Dependents: 0

Suggesters: 0

Stars: 1

1.0.0 2017-06-17 17:47 UTC

This package is not auto-updated.

Last update: 2026-03-29 09:37:57 UTC


README

String decoration library for PHP CLI output

CliTextDecoration

Installation

composer require gamu1012/cli-text-decoration

Basic Usage

<?php

require __DIR__ . '/vendor/autoload.php';

echo \Gamu1012\CliTextDecoration::setString("RED")->red()->decorate() . "\n";
echo \Gamu1012\CliTextDecoration::setString("MAGENTA-WHITE_BACKGROUND-UNDERLINE")->magenta()->whiteBackground()->underLine()->decorate() . "\n";

To decorate a character string, first set the target string with setString

The setString method returns a CliTextDecoration instance

Use this to connect chain of decoration information.

Finally, we use the decorate method to get the result

Method List

Front Color

  • black()
  • red()
  • green()
  • yellow()
  • magenta()
  • cyan()
  • white()

Background Color

  • blackBackground()
  • redBackground()
  • greenBackground()
  • yellowBackground()
  • magentaBackground()
  • cyanBackground()
  • whiteBackground()

Attribute

  • bold()
  • italic()
  • underLine()
  • blink()
  • hidden()