PHPackages                             gnello/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. gnello/php-openfire-restapi

ActiveLibrary[API Development](/categories/api)

gnello/php-openfire-restapi
===========================

Client for the REST API plugin of the OpenFire Server

3.0.1(5y ago)3013.8k↓16.7%13Apache-2.0PHPPHP &gt;=5.5.0

Since Oct 4Pushed 3y ago7 watchersCompare

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

READMEChangelog (1)Dependencies (4)Versions (5)Used By (0)

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

[](#php-openfire-restapi)

[![Latest Stable Version](https://camo.githubusercontent.com/7a4e3e083b8b14f12f382baab0b8cdfaaf8f30f132fa02b50d1bf3cb2fda9e33/68747470733a2f2f706f7365722e707567782e6f72672f676e656c6c6f2f7068702d6f70656e666972652d726573746170692f762f737461626c65)](https://packagist.org/packages/gnello/php-openfire-restapi) [![Total Downloads](https://camo.githubusercontent.com/073e2c531d1acc18323d1478d58ff593b6d240647a7fa00bbe970e8e913fa6a1/68747470733a2f2f706f7365722e707567782e6f72672f676e656c6c6f2f7068702d6f70656e666972652d726573746170692f646f776e6c6f616473)](https://packagist.org/packages/gnello/php-openfire-restapi)

A PHP client for the [Openfire](http://www.igniterealtime.org/projects/openfire) [REST API Plugin](https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html) which provides you the ability to manage an Openfire instance by sending a REST/HTTP request to the server.

Please read the [documentation](https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html) for further information on using this application.

This client completely supports the &gt;= 1.3.9 version of the [REST API Plugin](https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html).

Dependencies
------------

[](#dependencies)

The REST API plugin need to be installed and configured on your 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)

Installation
------------

[](#installation)

### Composer

[](#composer)

The best way to install php-openfire-restapi is to use Composer, run the following command:

```
composer require gnello/php-openfire-restapi

```

Read more about how to install and use Composer [here](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx).

Usage
-----

[](#usage)

### Instance and authentication

[](#instance-and-authentication)

There are two ways of authentication:

- Basic HTTP Authentication

```
use Gnello\OpenFireRestAPI\Client;

$client = new Client([
    'client' => [
        'username' => 'ironman',
        'password' => 'romanoff',
    ]
]);
```

- Shared secret key

```
use Gnello\OpenFireRestAPI\Client;

$client = new Client([
    'client' => [
        'secretKey' => 'hulkstink',
    ]
]);
```

Make sure to enable one of these authentication methods on your Openfire server.

### Configuration

[](#configuration)

You can configure the Client with the following options:

```
use Gnello\OpenFireRestAPI\Client;

$client = new Client([
    'client' => [
        'secretKey' => 'hulkstink',
        'scheme' => 'https',
        'basePath' => '/plugins/restapi/v1/',
        'host' => 'localhost',
        'port' => '9090',
    ],
    'guzzle'    => [
         //put here any options for Guzzle
    ]
]);
```

The only options required are those relating to the chosen authentication method.

### Check the response

[](#check-the-response)

This Client follows the [PSR-7](http://www.php-fig.org/psr/psr-7/) document, therefore any response is a ResponseInterface type:

```
if ($response->getStatusCode() == 200) {
    echo "Oh, great.";
    var_dump(json_decode($response->getBody()));
} else {
    echo "HTTP ERROR " . $response->getStatusCode();
}
```

### Users endpoint

[](#users-endpoint)

```
//Create a new user
$response = $client->getUserModel()->createUser([
    "username" => "admin",
    "name" => "Administrator",
    "email" => "admin@example.com",
    "password" => "p4ssword",
    "properties" => [
        [
            "key" => "console.order",
            "value" => "session-summary=0"
        ]
    ]
]);

//Delete a user
$response = $client->getUserModel()->deleteUser('ironman');

//Ban a user
$response = $client->getUserModel()->lockoutUser('ironman');

//Unban a user
$response = $client->getUserModel()->unlockUser('ironman');

//Please read the UserModel class for a complete list of available methods.
```

### Chat Rooms endpoint

[](#chat-rooms-endpoint)

```
//Create a chat room
$response = $client->getChatRoomModel()->createChatRoom([
    "roomName" => "global-1",
    "naturalName" => "global-1_test_hello",
    "description" => "Global chat room",
    "subject" => "Global chat room subject",
    "creationDate" => "2012-10-18T16:55:12.803+02:00",
    "modificationDate" => "2014-07-10T09:49:12.411+02:00",
    "maxUsers" => "0",
    "persistent" => "true",
    "publicRoom" => "true",
    "registrationEnabled" => "false",
    "canAnyoneDiscoverJID" => "true",
    "canOccupantsChangeSubject" => "false",
    "canOccupantsInvite" => "false",
    "canChangeNickname" => "false",
    "logEnabled" => "true",
    "loginRestrictedToNickname" => "true",
    "membersOnly" => "false",
    "moderated" => "false",
    "broadcastPresenceRoles" => [
        "moderator",
        "participant",
        "visitor"
    ],
    "owners" => [
       "owner@localhost"
    ],
    "admins" => [
       "admin@localhost"
    ],
    "members" => [
        "member@localhost"
    ],
    "outcasts" => [
        "outcast@localhost"
    ]
]);

//Retrieve a chat room
$response = $client->getChatRoomModel()->retrieveChatRoom('theavengers')

//Add a user with role to a chat room
use \Gnello\OpenFireRestAPI\Models\ChatRoomModel;
$response = $client->getChatRoomModel()->addUserWithRoleToChatRoom('theavengers', 'ironman', ChatRoomModel::ROLE_MEMBER);

//Delete a chat room
$response = $client->getChatRoomModel()->deleteChatRoom('theavengers');

//Please read the ChatRoomModel class for a complete list of available methods.
```

### Groups endpoint

[](#groups-endpoint)

```
//Create a group
$response = $client->getGroupModel()->createGroup([
    "name" => "theavengers",
    "description" => "team of superheroes appearing in American comic books published by Marvel Comics",
]);

//Retrieve a group
$response = $client->getGroupModel()->retrieveGroup('theavengers')

//Delete a group
$response = $client->getGroupModel()->deleteGroup('theavengers');

//Please read the GroupModel class for a complete list of available methods.
```

Endpoints supported
-------------------

[](#endpoints-supported)

All the endpoints are supported:

- [Users](https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html#user-related-rest-endpoints)
- [Chat Rooms](https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html#chat-room-related-rest-endpoints)
- [System](https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html#system-related-rest-endpoints)
- [Groups](https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html#group-related-rest-endpoints)
- [Sessions](https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html#session-related-rest-endpoints)
- [Messages](https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html#message-related-rest-endpoints)
- [Security Audit](https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html#security-audit-related-rest-endpoints)

Contact
-------

[](#contact)

- gnello

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 96.2% 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

Every ~489 days

Total

4

Last Release

2044d ago

Major Versions

v2.0.1 → 3.0.02019-05-19

PHP version history (2 changes)v2.0.0PHP &gt;=5.3.0

3.0.0PHP &gt;=5.5.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/3364624b5ca65e5501822875f02a9546c09224ea148f4c3bdf1c81f55f793802?d=identicon)[gnello](/maintainers/gnello)

---

Top Contributors

[![gnello](https://avatars.githubusercontent.com/u/19245006?v=4)](https://github.com/gnello "gnello (50 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

clientopenfirechatopenfire

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[saloonphp/saloon

Build beautiful API integrations and SDKs with Saloon

2.4k9.6M468](/packages/saloonphp-saloon)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.5k311.5k5](/packages/theodo-group-llphant)[gidkom/php-openfire-restapi

Manage Open fire server using Rest Api

56158.6k](/packages/gidkom-php-openfire-restapi)[get-stream/stream-chat

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

301.8M2](/packages/get-stream-stream-chat)[yoti/yoti-php-sdk

Yoti SDK for quickly integrating your PHP backend with Yoti

27539.9k1](/packages/yoti-yoti-php-sdk)

PHPackages © 2026

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