Skip to content
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.



Since you do not have direct access to MQTTCHAT databases, you need an SDK as an intermediary to add your users to MQTTCHAT, edit user's informations etc ... The SDK is based on calls to REST services hosted on our web servers. All queries are authenticated using OAuth2 protocol.
In this documentation we will see differents operations you can do with mqttchat PHP SDk.


Before you can use the SDk, you must install it using PHP Composer or download latest release from this repository and extract it in your website root directory.
The easiest way is to use php Composer,you should first install php composer software then install the sdk using this command line.

composer require med_aboub/mqttchat-php-sdk


You must now get your REST authentication parameters App_ID and APP_secret wich are specific to each domain and are necessary to authenticate with REST services.
To obtain them, you must first create MQTTCHAT account then activate a free or paied subscription for your domain. Once activation is successful, you will receive in your client area (settings tab) the two parameters App_ID and APP_secret.
yous should add theses two parameters to config file of your SDK located at : src/telifoun/mqttchat/config.php

namespace telifoun\mqttchat; 
 class config{     
    /** telifoun mqttchat app_id **/
    const APP_ID="mqttchat-xxxxxxxx";
    /** telifoun mqttchat app_secret **/
    const APP_SECRET="mqttchat-xxxxxxxxxxxxxxxx";  

Users Management

Add new user

Adding a new user to MQTTCHAT is done in two steps: first define user basic informations with Set function then add it to your domain users list using Add function.

require_once vendor/autoload.php;
$user=new telifoun\mqttchat\user();
if ($result["ok"]){
echo $result["response"]["error"];

If you don't like to add profile link or avatar link keep fields empties to be ignored.

Edit user

To edit existing user information’s, you should define the userid , informations to update then call Update function.

require_once vendor/autoload.php;
$user=new telifoun\mqttchat\user();
$user->_setName("Foulen 2");

And to verify that user information’s are changed, you can use Get function. Do not forget to specify user userid before.

require_once vendor/autoload.php;
$user=new telifoun\mqttchat\user();

Remove user

If you want to delete a user, the Remove function is made for that.

require_once vendor/autoload.php;
$user=new telifoun\mqttchat\user();

Friends management

If you do not use the notion of friends between users, you can skip this section. Since the concept of friends is an MQTTCHAT option for dating or social networks websites.
If friends option is enabled, all MQTTCHAT features will be limited to the friends list. Else user can browse the list of all users and can chat with any one.
Please see MQTTCHAT Documentation for more informations about this.

Add a new contact to friends list

To add a new friend to a user friends list:

require_once vendor/autoload.php;
$user=new telifoun\mqttchat\user();

To check if two users are friends:

require_once vendor/autoload.php;
$user=new telifoun\mqttchat\user();

Remove contact from friends list

require_once vendor/autoload.php;
$user=new telifoun\mqttchat\user();
You can’t perform that action at this time.