PHPackages                             gidkom/php-openfire-restapi - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. gidkom/php-openfire-restapi

ActiveLibrary[API Development](/categories/api)

gidkom/php-openfire-restapi
===========================

Manage Open fire server using Rest Api

1.0.0(8y ago)56158.6k↓39.1%38[5 issues](https://github.com/gidkom/php-openfire-restapi/issues)[2 PRs](https://github.com/gidkom/php-openfire-restapi/pulls)MITPHPPHP &gt;=5.4.0

Since Jan 31Pushed 1y ago9 watchersCompare

[ Source](https://github.com/gidkom/php-openfire-restapi)[ Packagist](https://packagist.org/packages/gidkom/php-openfire-restapi)[ Docs](https://github.com/gidkom/php-openfire-restapi)[ RSS](/packages/gidkom-php-openfire-restapi/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

php-openfire-restapi
====================

[](#php-openfire-restapi)

[![Join the chat at https:#gitter.im/gidkom/php-openfire-restapi]()](https:#gitter.im/gidkom/php-openfire-restapi?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

[![Build Status]()](https:#scrutinizer-ci.com/g/gidkom/php-openfire-restapi/build-status/master)

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

LICENSE
-------

[](#license)

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

DEPENDENCIES
------------

[](#dependencies)

The REST API plugin need to be installed and configured on the Openfire server.

- [how to install REST API](https:#www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html#installation)
- [How to configure REST API](https:#www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html#authentication)

REQUIREMENTS
------------

[](#requirements)

- PHP 5.4+

INSTALLATION
------------

[](#installation)

### With Composer

[](#with-composer)

---

The easiest way to install is via [composer](http:#getcomposer.org/). Create the following `composer.json` file and run the `composer.phar` install command to install it.

```
composer require gidkom/php-openfire-restapi:v1.1.0

```

#### OR

[](#or)

```
{
    "require": {
        "gidkom/php-openfire-restapi": "v1.1.0"
    }
}
```

EXAMPLE
=======

[](#example)

SETUP
-----

[](#setup)

```
include "vendor/autoload.php";
```

SET PARAMETERS
--------------

[](#set-parameters)

```
# Create the Openfire Rest api 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

```

### Response format

[](#response-format)

```
# Check result if command is succesful
if($result['status']) {
    # Display result
    print_r($result['data']);
} else {
    # Something went wrong
    echo 'Error: ';
    echo $result['data'];
}

```

### User related examples

[](#user-related-examples)

```
# Retrieve users
$options = ['search'=> 'John']; # optional
$result = $api->getUsers($options);

# Retrieve a user
$result = $api->getUser($username);

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

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

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

# Add user to a group
$result = $api->addToGroup($username, $groupName);

# Delete user from a group
$result = $api->deleteFromGroup($username, $groupName);

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

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

# Retrieve a user roster
$api->userRosters($username);

# Create a user roster entry
$api->addToRoster($username, $jid);

# Delete from roster
$api->deleteFromRoster($username, $jid);

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

```

### Chat room related Endpoints

[](#chat-room-related-endpoints)

```
# Get all chat rooms
$api->getAllChatRooms();

# Retrieve a chat room
$api->getChatRoom($name);

# Create a chat room
# $params  = ['naturalName'=>'myroom', 'roomName'=>'myroom', 'description'=>'my chat room'];
$api->createChatRoom($params);

# Delete a chat room
$api->deleteChatRoom($roomName);

# Update a chat room
# $params  = ['naturalName'=>'myroom', 'roomName'=>'myroom', 'description'=>'my fav chat room'];
$api->createChatRoom($roomName =>$params);

# Add user with role to chat room
$api->addUserRoleToChatRoom($roomName, $name, $role);

```

### System related Endpoints

[](#system-related-endpoints)

```
# Retrieve all system properties
$api->getSystemProperties();

# Retrieve a system property
$api->getSystemProperty('plugin.restapi.httpAuth');

# Create a system property
$api->createSystemProperty(['key'=>'test', 'value'=>'testname']);

# Update a system property
$api->updateSystemProperty(['key'=>'test', 'value'=>'testname']);

# Delete a system property
$api->deleteSystemProperty('test');

# Retrieve concurrent sessions
$api->getConcurrentSessons();

```

### Group related Endpoints

[](#group-related-endpoints)

```
# Get all groups
$api->getGroups();

# Retrieve group
$api->getGroup($groupName);

# Create a group
$api->createGroup($groupName, $description);

# Update a group description
$api->updateGroup($groupName, $description);

# Delete a group
$api->deleteGroup($groupName);

```

### Session related Endpoints

[](#session-related-endpoints)

```
# Retrieve all users sessions
$api->getSessions();

# Retrieve all users sessions
$api->getUserSessions($username);

# Close all user sessions
$api->closeUserSessions($username);

```

### Message related Endpoints

[](#message-related-endpoints)

```
# Send a broadcast message to all online users
$api->broadcastMessage('hello');

```

CONTACT
-------

[](#contact)

- gidkom

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance25

Infrequent updates — may be unmaintained

Popularity47

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3029d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a517e57a2f4e7d57168e0f06c472d58797425375c56708ff5b66b0d5fab0552b?d=identicon)[gidkom](/maintainers/gidkom)

---

Top Contributors

[![gidkom](https://avatars.githubusercontent.com/u/4060499?v=4)](https://github.com/gidkom "gidkom (55 commits)")[![ottoszika](https://avatars.githubusercontent.com/u/7945963?v=4)](https://github.com/ottoszika "ottoszika (3 commits)")[![umpirsky](https://avatars.githubusercontent.com/u/208957?v=4)](https://github.com/umpirsky "umpirsky (2 commits)")[![tibo9](https://avatars.githubusercontent.com/u/5981057?v=4)](https://github.com/tibo9 "tibo9 (1 commits)")[![gitter-badger](https://avatars.githubusercontent.com/u/8518239?v=4)](https://github.com/gitter-badger "gitter-badger (1 commits)")[![emamirazavi](https://avatars.githubusercontent.com/u/3804866?v=4)](https://github.com/emamirazavi "emamirazavi (1 commits)")[![alfredog1976](https://avatars.githubusercontent.com/u/28766561?v=4)](https://github.com/alfredog1976 "alfredog1976 (1 commits)")

---

Tags

chatxmppopenfire

### Embed Badge

![Health badge](/badges/gidkom-php-openfire-restapi/health.svg)

```
[![Health](https://phpackages.com/badges/gidkom-php-openfire-restapi/health.svg)](https://phpackages.com/packages/gidkom-php-openfire-restapi)
```

###  Alternatives

[get-stream/stream-chat

A PHP client for Stream Chat (https://getstream.io/chat/)

301.8M2](/packages/get-stream-stream-chat)[gnello/php-openfire-restapi

Client for the REST API plugin of the OpenFire Server

3013.8k](/packages/gnello-php-openfire-restapi)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
