omnicolor/php-irc-client 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

omnicolor/php-irc-client

Composer 安装命令:

composer require omnicolor/php-irc-client

包简介

PHP IRC client based on React

README 文档

README

A pure PHP IRC client based on ReactPHP.

Documentation

Client

The client is the heart of the library, this object is used to perform all communication between your application and the IRC server. It will manage the connection to the IRC server and has all functions needed to interact with the server.

use Jerodev\PhpIrcClient\IrcClient;

$client = new IrcClient('irc.server:6667', 'Jerodev');
$client->connect();

Connecting to the server

$client->connect()

This function opens the connection to the IRC server. Username has to be set before the connection can be opened.

Sending commands to the server

$client->send(string $command)

Sends a raw IRC command directly to the server. This method should only be used if you really know what you are doing, it is recommended to use the built-in functions below.

Name Type Description
$command string The raw irc command

Joining a channel

$client->join(string $channel)

Joins a specified channel

Name Type Description
$channel string The name of the channel to join.

Leaving a channel

$client->part(string $channel)

Leave a channel. If the specified channel has not yet been joined, nothing will happen.

Name Type Description
$channel string The name of the channel to part.

Sending messages

$client->say(string $target, string $message)

Sends a message to a channel or user.

Name Type Description
$target string A name of a channel staring with # or the nickname of the user to send a message to.
$message string The message to send to the target.

Events

The on() function on the client can be used to register to several different events. This can be done both before and after connecting to the IRC server. Events have variable callback arguments, all are described below.

Registered on server

$client->on('registered', function () { });

Emitted when the server sends the initial welcome message (001). This indicates that you are connected to the server.

Message of the day

$client->on('motd', function (string $motd) { });

Emitted when the server sends the message of the day to the client. If the message of the day is multiple lines, this event might be emitted multiple times.

Name Type Description
$motd string The server's Message Of The Day.

Topic changed

$client->on('topic', function (string $channel, string $topic) { });

Emitted when joining a channel or when the topic of a joined channel changes.

Name Type Description
$channel string The channel where the topic has changed.
$topic string The new topic for this channel.

Channel users received

$client->on('names', function (string $channel, string[] $nicks) { });

Emitted when the server sends a list of nicks for a channel. This happens immediately after joining a channel and on request.

Name Type Description
$channel string The channel name.
$names string[] A list of nicknames who are currently in this channel.

You can also specify the channel you want to listen on by adding #channel to the event.
For example: $client->on('names#channel', function ($names) {})

Message received

$client->on('message', function (string $from, IrcChannel $channel, string $message) { });

Emitted when a message is sent to a connected channel.

Name Type Description
$from string The nickname of the user who sent the message.
$channel IrcChannel The channel where the message was sent.
$message string The received message.

You can also specify the channel you want to listen on by adding #channel to the event.
For example: $client->on('message#channel', function ($from, $channel, $message) {})

Ping received

$client->on('ping', function () { });

Emitted when the server sends a ping request to the client. The pong request has already been sent back to the server before this event is emitted.

omnicolor/php-irc-client 适用场景与选型建议

omnicolor/php-irc-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.78k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 12 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 omnicolor/php-irc-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 omnicolor/php-irc-client 我们能提供哪些服务?
定制开发 / 二次开发

基于 omnicolor/php-irc-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 7.78k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 17
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-12-28