定制 gylraj/ejabberd 二次开发

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

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

gylraj/ejabberd

Composer 安装命令:

composer require gylraj/ejabberd

包简介

Ejabberd implementation using REST API

README 文档

README

Current implementation aims to integrate Ejabberd within your PHP implementation by using it' new API capabilities.

Ejabberd already offered a XML RPC, but according to their documentation this will soon be droped in flavor of their newer REST one. Although I searched the entire packagist.org repo, I could only find one (https://github.com/cloudadic/php-ejabberd), which ... isn't the best one: Guzzle is not properly required within composer.json and many code duplication (although it might be good for documentation)

Installation

composer require gylraj/ejabberd  
composer install

Usage

<?php
  
require __DIR__ . '/vendor/autoload.php';
  
use Ejabberd\Rest\Client;  
$client = new Client([
    'apiUrl' => 'http://127.0.0.1:5280/api/',
    'host' => 'chat.example.com'
    ]);

Examples

// Add User
$user = 'mumu';
$password = '123'
$client->createAccount($user, $password);
  
// Add a second User
$user = 'mumu-friend';
$password = '123'
$client->createAccount($user, $password);
  
// Add Roster between the two
$client->addRosterItem('mumu', "mumu-friend"));

More examples are placed under /examples folder

php examples/checkStatus.php

Disclaimer

When started with this wrapper, I was surprised by the lack (or active) support within PHP for XMPP. Most of the libraries were RPC based, which Ejabberd claim to drop its support.
For this, based on small talks ... arrived to three possibilities:

  1. The https://github.com/cloudadic/php-ejabberd style, but their code was the one that started me with this project
  2. A Factory pattern, but for someone that is not used with Ejabberd server it' hard to work with and no autocompletion within IDE
  3. Proxy: Same as above: no autocomplete
  4. Traits: Winner! A lot of wrappers, a lot of methods but we should split them in traits and reuse what we can reuse

Added Disclaimer

I really need this functions and can't wait for updates. I admire the owner and creator of this project. I just want to test my skills and add functions for the missing api.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-01-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固