stanx/fabiang-xmpp
Composer 安装命令:
composer require stanx/fabiang-xmpp
包简介
Library for XMPP protocol (Jabber) connections
README 文档
README
Library for XMPP protocol connections (Jabber) for PHP.
Forked from https://github.com/tohenk/xmpp (forked from https://github.com/fabiang/xmpp)
SYSTEM REQUIREMENTS
- PHP >= 7.0
- psr/log
- (optional) psr/log-implementation - like monolog/monolog for logging
INSTALLATION
New to Composer? Read the introduction. Add the following to your composer file:
composer require stanx/fabiang-xmpp
DOCUMENTATION
This library uses an object to hold options:
use Fabiang\Xmpp\Options; $options = new Options($address); $options->setUsername($username) ->setPassword($password) ->setTimeout(10);
The server address must be in the format tcp://myjabber.com:5222.
If the server supports TLS the connection will automatically be encrypted.
You can also pass a PSR-2-compatible object to the options object:
$options->setLogger($logger)
The client manages the connection to the Jabber server and requires the options object:
use Fabiang\Xmpp\Client; $client = new Client($options); // optional connect manually $client->connect();
For sending data you just need to pass a object that implements Fabiang\Xmpp\Protocol\ProtocolImplementationInterface:
use Fabiang\Xmpp\Protocol\Roster; use Fabiang\Xmpp\Protocol\Presence; use Fabiang\Xmpp\Protocol\Message; // fetch roster list; users and their groups $client->send(new Roster); // set status to online $client->send(new Presence); // send a message to another user $message = new Message; $message->setMessage('test') ->setTo('nickname@myjabber.com'); $client->send($message); // join a channel $channel = new Presence; $channel->setTo('channelname@conference.myjabber.com') ->setPassword('channelpassword') ->setNickName('mynick'); $client->send($channel); // send a message to the above channel $message = new Message; $message->setMessage('test') ->setTo('channelname@conference.myjabber.com') ->setType(Message::TYPE_GROUPCHAT); $client->send($message);
After all you should disconnect:
$client->disconnect();
BSD-2-Clause. See the LICENSE.
stanx/fabiang-xmpp 适用场景与选型建议
stanx/fabiang-xmpp 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 461 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 01 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「xmpp」 「jabber」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 stanx/fabiang-xmpp 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 stanx/fabiang-xmpp 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 stanx/fabiang-xmpp 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A client library for talking to XMPP servers.
Allows XMPP connection with Firebase Cloud Messaging. It can listen upstream messages and send downstream ones.
XMPP handler for Monolog
A client library for talking to XMPP servers.
Library for XMPP protocol (Jabber) connections
Symfony2 Bundle to integrate the strophe js library
统计信息
- 总下载量: 461
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 14
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: BSD-2-Clause
- 更新时间: 2021-01-25