jean553/symfony-openfire-bundle

Symfony 2 应用程序的 Openfire 服务器管理

dev-master 2016-03-29 03:48 UTC

This package is not auto-updated.

Last update: 2024-09-18 09:27:56 UTC


README

用于连接到 Openfire REST API 并执行常见任务的 Bundle。

安装

通过 composer

"require": {
    "jean553/symfony-openfire-bundle": "dev-master"
}

app/AppKernel.php

$bundles = array(
    new jean553\OpenfireBundle\OpenfireBundle()
);

使用

app/config/config.yml

parameters:
    openfire_service: "jean553\OpenfireBundle\Services\OpenfireService"

openfire:
    url: 'http://my-openfire-server:9090/plugins/restapi/v1'
    secret: 'abcdefghijklmnopqrst'

在控制器中

$service = $this->get('openfire.service');
$service->createUser('username', 'password');
$service->createChatRoom('chat_room_id','chat_room_name', 'username');

$userJid = $service->getJid('username');

测试

app/config/config_test.yml

parameters:
    openfire_service: "jean553\OpenfireBundle\Services\DummyOpenfireService"