PHP Classes

PHP Openfire REST API: Manage an Openfire server calling its REST API

Recommend this page to a friend!
  Info   View files Documentation   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 188 This week: 1All time: 8,613 This week: 571Up
Version License PHP version Categories
php-openfire-api 1.0.0MIT/X Consortium ...5.4PHP 5, Web services, Chat
Description 

Author

This class can manage an Openfire real time collaboration (RTC) server calling its REST API.

It can send HTTP requests the Web server of a given Openfire server to perform several management operations.

Currently it can get the list of Openfire users in the server, get the details of an user, add, remove, update, lockout and unlock users, add, remove and update users in a roster.

Picture of Gideon Kombian
  Performance   Level  
Name: Gideon Kombian <contact>
Classes: 2 packages by
Country: Ghana Ghana
Age: 33
All time rank: 34444 in Ghana Ghana
Week rank: 420 Up3 in Ghana Ghana Up

Documentation

php-openfire-restapi

A simple PHP class designed to work with Openfire Rest Api plugin. It is used to remote manage the Openfire server.

LICENSE

php-openfire-restapi is licensed under MIT style license, see LICENCE for further information.

REQUIREMENTS

  • PHP 5.4+

INSTALLATION

With Composer

The easiest way to install is via composer. Create the following composer.json file and run the composer.phar install command to install it.

{
    "require": {
        "gidkom/php-openfire-restapi": "dev-master"
    }
}

USAGE

include "vendor/autoload.php";

// Create the OpenfireUserservice object
$api = new Gidkom\OpenFireRestApi\OpenFireRestApi

// Set the required config parameters
$api->secret = "MySecret";
$api->host = "jabber.myserver.com";
$api->port = "9090";  // default 9090

// Optional parameters (showing default values)

$api->useSSL = false;
$api->plugin = "/plugins/restapi/v1";  // plugin 

// Add a new user to OpenFire and add to a group
$result = $api->addUser('Username', 'Password', 'Real Name', 'johndoe@domain.com', array('Group 1'));

// Check result if command is succesful
if($result['status']) {
    // Display result, and check if it's an error or correct response
    echo 'Success: ';
    echo $result['message'];
} else {
    // Something went wrong, probably connection issues
    echo 'Error: ';
    echo $result['message'];
}

//Delete a user from OpenFire
$result = $api->deleteUser($username);


//Disable a user
$result = $api->lockoutUser($username);


//Enable a user
$result = $api->unlockUser($username);

/
 * Update a user
 *
 * The $password, $name, $email, $groups arguments are optional
 * 
 */
$result = $api->updateUser($username, $password, $name, $email, $groups)

//Add to roster
$api->addToRoster($username, $jid);

//Delete from roster
$api->addToRoster($username, $jid);

//Update user roster
$api->updateRoster($username, $jid, $nickname, $subscription]);

CONTACT

  • gidkom <yoroumah@gmail.com>

  Files folder image Files  
File Role Description
Files folder imagesrc (1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Data Auxiliary data
Accessible without login Plain text file README.md Doc. Auxiliary data

  Files folder image Files  /  src  
File Role Description
Files folder imageGidkom (1 directory)

  Files folder image Files  /  src  /  Gidkom  
File Role Description
Files folder imageOpenFireRestApi (1 file)

  Files folder image Files  /  src  /  Gidkom  /  OpenFireRestApi  
File Role Description
  Plain text file OpenFireRestApi.php Class Application script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:188
This week:1
All time:8,613
This week:571Up