PHPackages                             chrismou/php-irc-text-formatting - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. chrismou/php-irc-text-formatting

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

chrismou/php-irc-text-formatting
================================

PHP library for adding color and styling to IRC text output

v1.0.1(10y ago)46052[1 PRs](https://github.com/chrismou/php-irc-text-formatting/pulls)BSD-2-ClausePHPPHP &gt;=5.3.0

Since Feb 15Pushed 10y ago1 watchersCompare

[ Source](https://github.com/chrismou/php-irc-text-formatting)[ Packagist](https://packagist.org/packages/chrismou/php-irc-text-formatting)[ Docs](https://github.com/chrismou/php-irc-text-formatting)[ RSS](/packages/chrismou-php-irc-text-formatting/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (3)Used By (0)

IRC color/style library for PHP
===============================

[](#irc-colorstyle-library-for-php)

PHP library for adding color and styling to IRC text output

[![Build Status](https://camo.githubusercontent.com/ed2cc09ada3b7f7fe85122a8a24c0e5c9a5e5fe53c9f6bcee40dde6418cfa554/68747470733a2f2f7472617669732d63692e6f72672f63687269736d6f752f7068702d6972632d746578742d666f726d617474696e672e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/chrismou/php-irc-text-formatting)[![Test Coverage](https://camo.githubusercontent.com/21f1ad61991cfedec81ad22562d44d8a35ba4d95297e8c7bf9674b03053d1c65/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f63687269736d6f752f7068702d6972632d746578742d666f726d617474696e672f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/chrismou/php-irc-text-formatting/coverage)[![Code Climate](https://camo.githubusercontent.com/07634559ce16a1f92c3dc10f7bc3ad934b392ab8c1ff12c271c69f006cf4887e/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f63687269736d6f752f7068702d6972632d746578742d666f726d617474696e672f6261646765732f6770612e737667)](https://codeclimate.com/github/chrismou/php-irc-text-formatting)[![Buy me a beer](https://camo.githubusercontent.com/84435278ebf644da9ba4ece64a76602c16bb88edd474ee54cc757a17eca9666f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f6e6174652d50617950616c2d3031394344452e737667)](https://www.paypal.me/chrismou)

About
-----

[](#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](https://github.com/phergie/phergie-irc-bot-react).

Install
-------

[](#install)

The recommended method of installation is [through composer](http://getcomposer.org).

```
composer require chrismou/php-irc-text-formatting

```

Configuration
-------------

[](#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:

```
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.

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

Usage
-----

[](#usage)

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

#### Color

[](#color)

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

```
$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

#### Style

[](#style)

This takes 2 parameters. First is the text, second is the style to use.

```
$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)

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

#### Rainbow

[](#rainbow)

This takes a single parameter - the text - and gives the string a rainbow colouring.

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

Tests
-----

[](#tests)

To run the unit test suite:

```
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:

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

```

License
-------

[](#license)

Released under the BSD License. See `LICENSE`.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~290 days

Total

2

Last Release

3818d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/98e0798db43673fb89fe589cbb45fb4c6547d3bdbe76d7efa30d96f24ffc677e?d=identicon)[chrismou](/maintainers/chrismou)

---

Top Contributors

[![chrismou](https://avatars.githubusercontent.com/u/319883?v=4)](https://github.com/chrismou "chrismou (24 commits)")

---

Tags

stylelibrarycolorirc

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/chrismou-php-irc-text-formatting/health.svg)

```
[![Health](https://phpackages.com/badges/chrismou-php-irc-text-formatting/health.svg)](https://phpackages.com/packages/chrismou-php-irc-text-formatting)
```

###  Alternatives

[league/iso3166

ISO 3166-1 PHP Library

69536.3M116](/packages/league-iso3166)[spatie/color

A little library to handle color conversions

38018.9M28](/packages/spatie-color)[dekor/php-array-table

PHP Library for printing associative arrays as text table (similar to mysql terminal console)

296.6M2](/packages/dekor-php-array-table)[davidgorges/color-contrast

A tiny library to find color combinations with a contrast threshold

10550.4k](/packages/davidgorges-color-contrast)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
