Skip to content

emmadesilva/simple-ansi-php-interface

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

simple-ansi-php-interface

A simple PHP interface providing convenient access to ANSI colours

Installation

Since this "package" is so simple, it's intended that you simply copy the interface file to your setup. You can do that by copying the included ANSI.php file, which is also available as a Gist, and possibly updating the namespace to suit your needs.

You can also simply copy the code below:

interface ANSI {
    const BLACK = "\033[30m";
    const RED = "\033[31m";
    const GREEN = "\033[32m";
    const YELLOW = "\033[33m";
    const BLUE = "\033[34m";
    const MAGENTA = "\033[35m";
    const CYAN = "\033[36m";
    const WHITE = "\033[37m";
    const RESET = "\033[0m";
}

Usage

The interface provides constants for the ANSI colour codes. You can use them like this:

echo ANSI::RED . 'This is red' . ANSI::RESET;

Screenshot

image

License

This package is licensed under the MIT license. See the LICENSE file for more information.

About

A simple PHP interface providing convenient access to ANSI colours

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Languages