PHP code example of sitedyno / irc-format-stripper
1. Go to this page and download the library: Download sitedyno/irc-format-stripper library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sitedyno / irc-format-stripper example snippets
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
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