wildphp/irc-messages
最新稳定版本:v0.3.1
Composer 安装命令:
composer require wildphp/irc-messages
包简介
IRC messages implementation for WildPHP
README 文档
README
Implementation of various IRC messages designed for WildPHP.
Installation
To install this package, you need Composer.
$ composer require wildphp/irc-messages ^0.1
Usage
These messages can be used standalone without usage of any other utilities. For example:
// Privmsg(string $channel, string $message) $privmsg = new Privmsg('#channel', 'This is a message'); $rawMessage = (string) $privmsg; //: "PRIVMSG #channel :This is a message" + "\r\n"
IncomingMessage instances may be created from parsed messages, which is useful if you just want a generic
representation of the message. These can be casted into specialized objects if the message type implements IncomingMessageInterface.
// IncomingMessage(string $prefix, string $verb, array $args) $incoming = new IncomingMessage('nickname!username@hostname', 'PRIVMSG', ['This is a message']); $privmsg = Privmsg::fromIncomingMessage($incoming);
A utility class is provided which tries to find the most appropriate class to specialize messages to.
$incoming = new IncomingMessage('nickname!username@hostname', 'PRIVMSG', ['This is a message']); $privmsg = MessageCaster::castMessage($incoming); // $privmsg is now an object of the Privmsg class.
Numeric messages are stored in the RPL directory under their official name, because PHP does not support numeric class names.
You can use the RplTranslateEnum class to translate numeric verbs into the corresponding class names.
Make sure to pass the numerics as strings to account for leading zeroes. A numeric like '3' will not be accepted.
$topicClass = RplTranslateEnum::translateNumeric('332'); // $topicClass is now '\WildPHP\Messages\RPL\Topic'
Implemented messages
Messages can be implemented as incoming or outgoing messages.
An incoming message may be converted from an IncomingMessage class.
An outgoing message may be converted to a string in order to send it to an IRC server.
| Name | As incoming? | As outgoing? | Extra's? |
|---|---|---|---|
| 001/RPL_WELCOME | x | ||
| 005/RPL_ISUPPORT | x | ||
| 332/RPL_TOPIC | x | ||
| 353/RPL_NAMREPLY | x | ||
| 354/RPL_WHOSPCRPL | x | ||
| 366/RPL_ENDOFNAME | x | ||
| ACCOUNT | x | ||
| AUTHENTICATE | x | x | |
| AWAY | x | x | |
| CAP | x | x | |
| ERROR | x | ||
| JOIN | x | x | extended-join support for incoming messages |
| KICK | x | x | |
| MODE | x | x | |
| NAMES | x | ||
| NICK | x | x | |
| NOTICE | x | x | |
| PART | x | x | |
| PASS | x | ||
| PING | x | x | |
| PONG | x | x | |
| PRIVMSG | x | x | |
| QUIT | x | x | |
| REMOVE | x | ||
| TOPIC | x | x | |
| USER | x | x | |
| VERSION | x | ||
| WHO | x | x | |
| WHOIS | x | ||
| WHOWAS | x |
Contributors
You can see the full list of contributors in the GitHub repository.
wildphp/irc-messages 适用场景与选型建议
wildphp/irc-messages 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.77k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 11 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 wildphp/irc-messages 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 wildphp/irc-messages 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.77k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 7
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-11-07