wyrihaximus / react-psr-3-phergie
将 Phergie 转换为 PSR-3 记录器
1.0.0
2018-01-09 21:32 UTC
Requires
- php: ^7.0
- phergie/phergie-irc-bot-react: ^2.1
- psr/log: ^1.0
- reactivex/rxphp: ^2.0
- wyrihaximus/psr-3-utilities: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.3
- jakub-onderka/php-console-highlighter: ^0.3.2
- jakub-onderka/php-parallel-lint: ^0.9.2
- phake/phake: ^2.3
- phpunit/phpunit: ^5.7.15
This package is auto-updated.
Last update: 2024-09-03 09:50:21 UTC
README
安装
要通过 Composer 安装,请使用以下命令,它将自动检测最新版本并将其绑定到 ~
。
composer require wyrihaximus/react-psr-3-phergie
用法
请确保按示例中的顺序排列一切,这对防止将您的 IRC 密码放入日志中很重要
// Zero create the ReactPHP Event loop (assuming you don't already did) $loop = Factory::create(); // First create the logger, in this example Monolog is assumed $logger = new Logger('your app'); // Then create the plugin $plugin = new PhergiePSR3Plugin('#logs-channel'); // Thirdly set up your logger the way you like /** * Logger set up magic */ // Fourth add handlers /** * Add any other handlers here, before the fith step, to ensure it * doesn't leak the password */ // Fith wrap the logger in wyrihaximus/psr-3-keyword-filter $logger = new MessageKeywordFilterLogger(['PASS', 'PRIVMSG'], $logger); // Sixth create the Phergie Client $client = new Client(); $client->setLoop($loop); $client->setLogger($logger); // Seventh create the Phergie bot $bot = new Bot(); // Eighth create the Pergie connection $connection = new Connection([ // Your connection config here ]); // Nineth add the config combining the connection and plugin $bot->setConfig([ 'plugins' => [ $loggingPlugin, new EventFilterPlugin([ // phergie/phergie-irc-plugin-react-eventfilter 'filter' => new ConnectionFilter([ $connection, ]), 'plugins' => [ new AutoJoinPlugin([ // phergie/phergie-irc-plugin-react-autojoin 'channels' => [ '#logs-channel', ], ]), ], ]), ], 'connections' => [ $connection, ], ]); // Tenth set the client and run the bot (note that the false is to ensure this doesn't run the event loop) $bot->setClient($client); $bot->run(false);
许可证
版权所有 2018 Cees-Jan Kiewiet
在此,任何人免费获得本软件及其相关文档副本(“软件”),均可不受限制地处理软件,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或出售软件副本,并允许向软件提供副本的个人这样做,前提是遵守以下条件
上述版权声明和本许可声明应包含在软件的所有副本或主要部分中。
软件按“原样”提供,不提供任何明示或暗示的保证,包括但不限于适销性、特定用途适用性和非侵权性保证。在任何情况下,作者或版权所有者均不对任何索赔、损害或其他责任负责,无论源于合同、侵权或其他原因,均与软件或其使用或其他方式有关。