定制 updivision/xmpp 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

updivision/xmpp

Composer 安装命令:

composer require updivision/xmpp

包简介

Library for XMPP protocol (Jabber) connections

关键字:

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License Build Status Scrutinizer Quality Score Coverage Status Dependency Status

Library for XMPP protocol connections (Jabber) for PHP.

SYSTEM REQUIREMENTS

  • PHP >= 5.3.3
  • psr/log
  • psr/log-implementation - like monolog/monolog for logging (optional)

INSTALLATION

New to Composer? Read the introduction. Add the following to your composer file:

{
    "require": {
        "updivision/xmpp": "*"
    }
}

DOCUMENTATION

This library uses an object to hold options:

use Updivision\Xmpp\Options;
$options = new Options($address);
$options->setUsername($username)
    ->setPassword($password);

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 Updivision\Xmpp\Client;
$client = new Client($options);
// optional connect manually
$client->connect();

For sending data you just need to pass a object that implements Updivision\Xmpp\Protocol\ProtocolImplementationInterface:

use Updivision\Xmpp\Protocol\Roster;
use Updivision\Xmpp\Protocol\Presence;
use Updivision\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')
    ->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();

DEVELOPING

If you like this library and you want to contribute, make sure the unit-tests and integration tests are running. Composer will help you to install the right version of PHPUnit and Behat.

composer install --dev

After that:

./vendor/bin/phpunit -c tests
./vendor/bin/behat --config=tests/behat.yml --strict

New features should allways tested with Behat.

LICENSE

BSD-2-Clause. See the LICENSE.

TODO

  • Better integration of channels
  • Factory method for server addresses
  • improve documentation

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 83
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-2-Clause
  • 更新时间: 2017-05-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固