Skip to content

cfyer/colorize-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple PHP library for change cli output color

Installation

composer require cfyer/colorize-cli

How To Use

<?php

require './vendor/autoload.php';

use Cfyer\ColorizeCli\CliColor;

echo CliColor::paint('text', 'yellow', 'bg');

or

echo CliColor::fg('red') . "Hello" . CliColor::RESET . PHP_EOL;
echo CliColor::bg('red') . "Hello" . CliColor::RESET . PHP_EOL;
echo CliColor::ul('red') . "Hello" . CliColor::RESET . PHP_EOL;
echo CliColor::bold('red') . "Hello" . CliColor::RESET . PHP_EOL;

output

Styles

  • background : bg
  • foreground : fg
  • underline : ul
  • bold : bold

Colors

  • black
  • red
  • green
  • yellow
  • blue
  • purple
  • cyan
  • white

Pad

echo CliColor::pad("input", 8, '#', 'both') . PHP_EOL;
echo CliColor::bg('blue');
echo CliColor::pad("input", 8, ' ', 'both') . CliColor::RESET;

output

Aligns

  • left
  • right
  • both

Other Examples

$mysqli = new mysqli('localhost', 'root', '', 'dbname');
echo CliColor::bold('yellow') . "Connected to {$mysqli->server_info} - ";
echo CliColor::bold('blue') . "{$mysqli->host_info}" . CliColor::RESET;

output

License

The MIT License (MIT). See License File for more information.

About

Simple PHP library for change cli output color

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages