srknzcn/terminal

There is no license information available for the latest version (dev-master) of this package.

PHP CLI/Terminal for color, blink and format output messages

dev-master 2020-05-30 15:59 UTC

This package is not auto-updated.

Last update: 2024-05-12 10:52:01 UTC


README

PHP CLI/Terminal for color, blink and format output messages

Installation and Usage

require srknzcn/terminal package as dev-master in your composer.json file

Usage:

<?php

include "./vendor/autoload.php";

use CLI\Terminal;

// simple output
Terminal::writeln("Hello World");

// colorize the output
Terminal::writeln("Hello World", "red");

// blink parameter flashes the output
Terminal::writeln("Hello World", "yellow", "blink");

// bold, underline and color 
Terminal::writeln("Hello World", "cyan", "bold", "underline");

// changing of parameeters order does't matter
Terminal::writeln("Hello World", "bold", "blink", "cyan", "underline");

// red on yellow background
Terminal::writeln("Hello World", "onyellow", "red");

// only print message to output. don't add new line
Terminal::write("Hello World");

// kills the script and prints message to output
Terminal::dieln("I'm died :(", "yellow", "underline);

Formatter attributes:

  • bold
  • dark
  • faint
  • underline
  • underscore
  • blink
  • reverse

Color attributes:

  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white
  • brightblack
  • brightred
  • brightgreen
  • brightyellow
  • brightblue
  • brightmagenta
  • brightcyan
  • brightwhite

Background color attributes:

  • onblack
  • onred
  • ongreen
  • onyellow
  • onblue
  • onmagenta
  • oncyan
  • onwhite
  • onbrightblack
  • onbrightred
  • onbrightgreen
  • onbrightyellow
  • onbrightblue
  • onbrightmagenta
  • onbrightcyan
  • onbrightwhite