PHP Chat Client

PHP Chat Client


iFlyChat PHP Client GitHub page

  • Step 2 - Next, generate an API key in order to use our servers securely with your website. To do so go to and signup to create a new account.


Signup at

  • Step 3 - Now, go to Dashboard and Generate a new API key for your domain name.


Go to Dashboard


Generate a new API key

Generate a new API key for your domain


  • Step 4 - Copy the newly generated API key.


Copy API key


  • Step 5 - Next, go to iflychatsettings.php (inside iflychat-php folder) and paste your API key there. This will allow your website to use our servers for processing chat requests.


  • Step 6 - Open iflychat-save-settings.php (inside iflychat-php folder) within your browser. This will update settings for your website on our server. You need to do this every time you update any setting option in iflychatsettings.php.


  • Step 7 - Now, you need to include iFlyChat HTML code in your website. As an example, check out index.php (inside iflychat-php folder). To do so, add the following line of code before printing anything on the webpage:
    global $iflychat_userinfo;
    $iflychat_settings = new iFlyChatSettings();
    $iflychat = new iFlyChat($iflychat_settings->iflychat_settings, $iflychat_userinfo->getUserDetails());
    $ifly_html_code = $iflychat->getHtmlCode();


  • Step 8 - Make sure to use the above code before printing any content via PHP, otherwise you will get an error. Next, use the following code anywhere in your PHP file (preferably before body tag ends) to render the chat:
    print $ifly_html_code;



  • Step 9 - After this you need to provide some details of the current user who will join the chat. To do so, open iflychatuserdetails.php and edit $iflychat_userinfo object in it. You need to pass details of current logged-in user into $iflychat_userinfo object. You may get this information from your database or PHP session ($_SESSION).
    global $iflychat_userinfo;
    $iflychat_userinfo = new iFlyChatUserDetails('admin', 1);

    If the current user is not a registered user, then set $iflychat_userinfo as an empty array as shown below:

    $iflychat_userinfo = new iFlyChatUserDetails();


  • That's it!


  • Optional: To Embed Chatroom in a page, click here.