PHP Chat Client
Learn how to integrate our chat into your PHP website
How to integrate iFlyChat with any PHP based website
Step 1: You can get the iFlyChat PHP library via a composer package called iflychat-php
. See https://packagist.org/packages/iflylabs/iflychat-php.
Or add to composer.json
:
and then run composer update
.
Or you can clone or download the library files.
We recommend you to use composer.
Step 2: Generate APP ID and API Key from iflychat.com and copy them.
Step 3: Use these credentials in your main php(index) file to create a new iFlyChat
instance.
Step 4(optional): In case, you want to create a user for the chat, you just need to call the setUser()
function with $user
array as a parameter.
Example.
Step 5: Now, you need to include iFlyChat HTML code in your website. As an example, check out basic-example.php
(inside iflychat-php/examples
folder). To do so, add the following line of code before printing anything on the webpage:
Step 6: 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:
Last updated