sitedyno / irc-format-stripper
Strips irc formatters from a string
v1.0.1
2016-12-25 23:45 UTC
Requires (Dev)
- phpunit/phpunit: ~4
- squizlabs/php_codesniffer: ^2.6
This package is auto-updated.
Last update: 2024-12-06 10:00:09 UTC
README
Library to strip IRC format codes from strings.
Install
The recommended method of installation is through composer.
php composer.phar require sitedyno/irc-format-stripper
Configuration
There is no configuration at the moment.
Usage Example
use Sitedyno\Irc\Format\Stripper; $stripper = new Stripper; $testMessage = "\x0301This text is black in IRC"; echo $testMessage; // Outputs: 01This text is black in IRC $strippedMessage = $stripper->strip($testMessage); echo $strippedMessage; // Outputs: This text is black in IRC
Monolog Processor Example
use Sitedyno\Irc\Format\Stripper; $stripper = new Stripper; $testMessage = "\x0301This text is black in IRC"; echo $testMessage; // Outputs: 01This text is black in IRC $streamHandler = new \Monolog\Handler\StreamHandler( 'mylog.log', \Monolog\Logger::DEBUG ); $logger = new \Monolog\Logger( 'mylog', [$streamHandler] ); $logger->pushProcessor(function($record) use ($stripper) { $record['message'] = $stripper->strip($record['message']); return $record; }); $logger->info($testMessage); // Outputs to mylog.log: [2016-12-25 22:00:52] mylog.INFO This text is black in IRC
Testing
To run the unit test suite:
curl -s https://getcomposer.org/installer | php
php composer.phar install
./vendor/bin/phpunit
License
Released under the MIT License. See LICENSE.md
.