{"id":36992611,"url":"https://github.com/gnello/php-openfire-restapi","last_synced_at":"2026-01-13T23:44:45.956Z","repository":{"id":38108121,"uuid":"59250489","full_name":"gnello/php-openfire-restapi","owner":"gnello","description":"A complete PHP client for the Openfire REST API Plugin.","archived":false,"fork":false,"pushed_at":"2023-05-10T22:29:59.000Z","size":207,"stargazers_count":30,"open_issues_count":0,"forks_count":13,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-08-09T22:52:20.503Z","etag":null,"topics":["client","openfire"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gnello.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-19T23:39:30.000Z","updated_at":"2024-03-15T03:20:00.000Z","dependencies_parsed_at":"2022-09-03T23:03:34.420Z","dependency_job_id":null,"html_url":"https://github.com/gnello/php-openfire-restapi","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/gnello/php-openfire-restapi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnello%2Fphp-openfire-restapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnello%2Fphp-openfire-restapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnello%2Fphp-openfire-restapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnello%2Fphp-openfire-restapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gnello","download_url":"https://codeload.github.com/gnello/php-openfire-restapi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnello%2Fphp-openfire-restapi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28405214,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client","openfire"],"created_at":"2026-01-13T23:44:45.863Z","updated_at":"2026-01-13T23:44:45.939Z","avatar_url":"https://github.com/gnello.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# php-openfire-restapi\n\n[![Latest Stable Version][10]][11] [![Total Downloads][14]][15]\n\nA PHP client for the [Openfire][1] [REST API Plugin][2] which provides you the ability\n to manage an Openfire instance by sending a REST/HTTP request to the server.\n\nPlease read the [documentation][2] for further information on using this application.\n\nThis client completely supports the \u003e= 1.3.9 version of the [REST API Plugin][2].\n \n## Dependencies\nThe REST API plugin need to be installed and configured on your Openfire server.\n\n- [How to install REST API][3]\n- [How to configure REST API][4]\n\n## Installation\n### Composer\nThe best way to install php-openfire-restapi is to use Composer, run the following command:\n\n```\ncomposer require gnello/php-openfire-restapi\n```\n\nRead more about how to install and use Composer [here][9].\n\n## Usage\n### Instance and authentication\nThere are two ways of authentication:\n\n- Basic HTTP Authentication\n```php\nuse Gnello\\OpenFireRestAPI\\Client;\n\n$client = new Client([\n    'client' =\u003e [\n        'username' =\u003e 'ironman',\n        'password' =\u003e 'romanoff',\n    ]\n]);\n```\n- Shared secret key\n```php\nuse Gnello\\OpenFireRestAPI\\Client;\n\n$client = new Client([\n    'client' =\u003e [\n        'secretKey' =\u003e 'hulkstink',\n    ]\n]);\n```\nMake sure to enable one of these authentication methods on your Openfire server.\n\n### Configuration\nYou can configure the Client with the following options:\n```php\nuse Gnello\\OpenFireRestAPI\\Client;\n\n$client = new Client([\n    'client' =\u003e [\n        'secretKey' =\u003e 'hulkstink',\n        'scheme' =\u003e 'https',\n        'basePath' =\u003e '/plugins/restapi/v1/',\n        'host' =\u003e 'localhost',\n        'port' =\u003e '9090',\n    ],\n    'guzzle'    =\u003e [\n         //put here any options for Guzzle\n    ]\n]);\n```\nThe only options required are those relating to the chosen authentication method.\n\n### Check the response\nThis Client follows the [PSR-7][5] document, therefore any response is a ResponseInterface type:\n```php\nif ($response-\u003egetStatusCode() == 200) {\n    echo \"Oh, great.\";\n    var_dump(json_decode($response-\u003egetBody()));\n} else {\n    echo \"HTTP ERROR \" . $response-\u003egetStatusCode();\n}\n```\n### Users endpoint\n```php\n//Create a new user\n$response = $client-\u003egetUserModel()-\u003ecreateUser([\n    \"username\" =\u003e \"admin\",\n    \"name\" =\u003e \"Administrator\",\n    \"email\" =\u003e \"admin@example.com\",\n    \"password\" =\u003e \"p4ssword\",\n    \"properties\" =\u003e [\n        [\n            \"key\" =\u003e \"console.order\",\n            \"value\" =\u003e \"session-summary=0\"\n        ]\n    ]\n]);\n\n//Delete a user\n$response = $client-\u003egetUserModel()-\u003edeleteUser('ironman');\n\n//Ban a user\n$response = $client-\u003egetUserModel()-\u003elockoutUser('ironman');\n\n//Unban a user\n$response = $client-\u003egetUserModel()-\u003eunlockUser('ironman');\n\n//Please read the UserModel class for a complete list of available methods.\n```\n### Chat Rooms endpoint\n```php\n//Create a chat room\n$response = $client-\u003egetChatRoomModel()-\u003ecreateChatRoom([\n    \"roomName\" =\u003e \"global-1\",\n    \"naturalName\" =\u003e \"global-1_test_hello\",\n    \"description\" =\u003e \"Global chat room\",\n    \"subject\" =\u003e \"Global chat room subject\",\n    \"creationDate\" =\u003e \"2012-10-18T16:55:12.803+02:00\",\n    \"modificationDate\" =\u003e \"2014-07-10T09:49:12.411+02:00\",\n    \"maxUsers\" =\u003e \"0\",\n    \"persistent\" =\u003e \"true\",\n    \"publicRoom\" =\u003e \"true\",\n    \"registrationEnabled\" =\u003e \"false\",\n    \"canAnyoneDiscoverJID\" =\u003e \"true\",\n    \"canOccupantsChangeSubject\" =\u003e \"false\",\n    \"canOccupantsInvite\" =\u003e \"false\",\n    \"canChangeNickname\" =\u003e \"false\",\n    \"logEnabled\" =\u003e \"true\",\n    \"loginRestrictedToNickname\" =\u003e \"true\",\n    \"membersOnly\" =\u003e \"false\",\n    \"moderated\" =\u003e \"false\",\n    \"broadcastPresenceRoles\" =\u003e [\n        \"moderator\",\n        \"participant\",\n        \"visitor\"\n    ],\n    \"owners\" =\u003e [\n       \"owner@localhost\"\n    ],\n    \"admins\" =\u003e [\n       \"admin@localhost\"\n    ],\n    \"members\" =\u003e [\n        \"member@localhost\"\n    ],\n    \"outcasts\" =\u003e [\n        \"outcast@localhost\"\n    ]\n]);\n\n//Retrieve a chat room\n$response = $client-\u003egetChatRoomModel()-\u003eretrieveChatRoom('theavengers')\n\n//Add a user with role to a chat room\nuse \\Gnello\\OpenFireRestAPI\\Models\\ChatRoomModel;\n$response = $client-\u003egetChatRoomModel()-\u003eaddUserWithRoleToChatRoom('theavengers', 'ironman', ChatRoomModel::ROLE_MEMBER);\n\n//Delete a chat room\n$response = $client-\u003egetChatRoomModel()-\u003edeleteChatRoom('theavengers');\n\n//Please read the ChatRoomModel class for a complete list of available methods.\n```\n### Groups endpoint\n```php\n//Create a group\n$response = $client-\u003egetGroupModel()-\u003ecreateGroup([\n    \"name\" =\u003e \"theavengers\",\n    \"description\" =\u003e \"team of superheroes appearing in American comic books published by Marvel Comics\",\n]);\n\n//Retrieve a group\n$response = $client-\u003egetGroupModel()-\u003eretrieveGroup('theavengers')\n\n//Delete a group\n$response = $client-\u003egetGroupModel()-\u003edeleteGroup('theavengers');\n\n//Please read the GroupModel class for a complete list of available methods.\n```\n\n## Endpoints supported  \nAll the endpoints are supported:\n \n- [Users](https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html#user-related-rest-endpoints)\n- [Chat Rooms](https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html#chat-room-related-rest-endpoints)\n- [System](https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html#system-related-rest-endpoints)\n- [Groups](https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html#group-related-rest-endpoints)\n- [Sessions](https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html#session-related-rest-endpoints)\n- [Messages](https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html#message-related-rest-endpoints)\n- [Security Audit](https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html#security-audit-related-rest-endpoints)\n\n## Contact\n- gnello luca@gnello.com\n\n[1]: http://www.igniterealtime.org/projects/openfire\n[2]: https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html\n[3]: https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html#installation\n[4]: https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html#authentication\n[5]: http://www.php-fig.org/psr/psr-7/\n[9]: https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx\n[10]: https://poser.pugx.org/gnello/php-openfire-restapi/v/stable\n[11]: https://packagist.org/packages/gnello/php-openfire-restapi\n[14]: https://poser.pugx.org/gnello/php-openfire-restapi/downloads\n[15]: https://packagist.org/packages/gnello/php-openfire-restapi\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgnello%2Fphp-openfire-restapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgnello%2Fphp-openfire-restapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgnello%2Fphp-openfire-restapi/lists"}