2017 © Pedro Peláez
 

library php-irc-text-formatting

PHP library for adding color and styling to IRC text output

image

chrismou/php-irc-text-formatting

PHP library for adding color and styling to IRC text output

  • Thursday, March 24, 2016
  • by chrismou
  • Repository
  • 1 Watchers
  • 4 Stars
  • 172 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 3 Versions
  • 2 % Grown

The README.md

IRC color/style library for PHP

PHP library for adding color and styling to IRC text output, (*1)

Build Status Test Coverage Code Climate Buy me a beer, (*2)

About

This plugin is designed to provide IRC script writers a simple way to add colors/styles to their output. It should be compatible with most major PHP IRC bots, such as Phergie., (*3)

Install

The recommended method of installation is through composer., (*4)

composer require chrismou/php-irc-text-formatting

Configuration

To begin adding formatting to ouput text within your own applications, you'll need to include it in your project. The simplest way of doing this is as follows:, (*5)

protected $format;

function __construct(array $config=array())
{
    $this->format = new \Chrismou\Irc\TextFormatting\Format;
    ...
}

Or, if you're only using it once, you can just include it directly in your method., (*6)

public function foo
{
    $format = new \Chrismou\Irc\TextFormatting\Format;
    ...
}

Usage

The 3 methods available are color, style and rainbow., (*7)

Color

This takes 3 parameters. First is the text, second is the text color, third is the background colour (optional)., (*8)

$format = new \Chrismou\Irc\TextFormatting\Format;
$format->color("This text will be red", "red");
$format->color("This text will be blue on a green background", "blue", "green");

Available color codes: * white * black * blue * green * red * brown * purple * orange * yellow * lightGreen * teal * cyan * lightBlue * pink * grey * lightGrey, (*9)

Style

This takes 2 parameters. First is the text, second is the style to use., (*10)

$format = new \Chrismou\Irc\TextFormatting\Format;
$format->style("This text will be underlined", "underline");

Available style codes: * bold * underline * reverse (switches foreground and background color), (*11)

I've purposely excluded strikethrough and italic codes as support for them among IRC clients is fairly poor., (*12)

Rainbow

This takes a single parameter - the text - and gives the string a rainbow colouring., (*13)

$format = new \Chrismou\Irc\TextFormatting\Format;
$format->rainbow("This text will be FABULOUS"); // produces rainbow coloured text

Tests

To run the unit test suite:, (*14)

curl -s https://getcomposer.org/installer | php
php composer.phar install
./vendor/bin/phpunit

Or to test on all supported versions, ensure docker is installed and running, then run:, (*15)

curl -s https://getcomposer.org/installer | php
php composer.phar install
./vendor/bin/dunit

License

Released under the BSD License. See LICENSE., (*16)

The Versions

24/03 2016

dev-master

9999999-dev https://github.com/chrismou/php-irc-text-formatting

PHP library for adding color and styling to IRC text output

  Sources   Download

BSD-2-Clause

The Requires

  • php >=5.3.0

 

The Development Requires

style library irc color

03/12 2015

v1.0.1

1.0.1.0 https://github.com/chrismou/php-irc-text-formatting

PHP library for adding color and styling to IRC text output

  Sources   Download

BSD-2-Clause

The Requires

  • php >=5.3.0

 

The Development Requires

style library irc color

15/02 2015

1.0.0

1.0.0.0 https://github.com/chrismou/php-irc-text-formatting

PHP library for adding color and styling to IRC text output

  Sources   Download

BSD-2-Clause

The Requires

  • php >=5.3.0

 

The Development Requires

style library irc color