Chat

This extension (for registered users only) adds chatting feature to your site, powered by [Chatify](https://chatify.munafio.com/) which is an **one-to-one** users chatting system using [Pusher](https://pusher.com/).

Pusher supports free **Sandbox** plan which allow 100 concurrent connections and 200,000 messages per day. If you need more, you can upgrade to paid plans.

Pusher Channels provides realtime communication between servers, apps and devices. To publish an event to your web app using Pusher Channels, you need to get your free API keys first.

Set up Pusher

[Create an account](https://dashboard.pusher.com/accounts/sign_up) and then create a Channels app, e.g.

To get API keys, from the Pusher Dashboard, navigate to **App Keys**. Copy your **app_id**, **key**, **secret**, and **cluster**.

Set up Extension

Go to PHPMaker and click **Tools -> Extensions**, select the **Chatify** extension, **make sure you read the notes carefully first as they contain information that you should know**. Then enable the extension.

Click the **Advanced** tab, and enter your **app_id**, **key**, **secret**, and **cluster**. Then select the users table in your project. In this example, we use the demo project so the users table is "employees".

To make the Chatify works you need to alter your users table to add a few fields and add 2 tables to the main database (to which your users table belong). **If you cannot alter the database schema of your main database, you will not be able to use this extension.**

**Note** Since the chat widget allows searching users. The feature will therefore expose all display names (or first/last names) in the users table. If you do not allow that, you should create another table as the users table for the chatting feature, and insert only the users that you allow chatting into the table.

- **Users** (table) - Existing [Users table](https://phpmaker.dev/docs/#/securitysetup.html) of the project (or another table) - ID (primary key field) - The **primary key** field of the table - Name (field) - User display name field. If there is no "Name" field in the table, both "First name" and "Last name" field must be provided. - First name (field) - Only required if no "Name" field in the table - Last name (field) - Only required if no "Name" field in the table - Email (field) - **Avatar** (field) - New field to be added - **Active status** (field) - New field to be added - **Messenger color** (field) - New field to be added - **Created at** (field) - New field to be added - **Messages** (table) - New table to be added - ID (primary key field) - From ID (field) - To ID (field) - Body (field) - Attachment (field) - Seen (field) - Created at (field) - **Favorites** (table) - New table to be added - ID (primary key field) - User ID (field) - Favorite Id (field) - Created at (field)

If the table/field already exists, you can simply select it. If the table/field does not exist, you need to create it. All fields listed above are required, except for the "Name", "First name" and "Last name" fields of the users table. You only need either the "Name" field, or the combination of "First name" and "Last name" fields.

To add a column to your users table, simply the "..." button next to the field name, change the field name if necessary, and press the "OK" button, e.g.

To create the **Messages** and **Favorites**, simply the "..." button next to the table name, change the table/field names if necessary, and press the "OK" button, e.g.

**Notes** 1. All tables must be from the main database. 1. The table/field names will be created as entered, change the letter case of the names if necessary. 1. Table/Field names should contain alphanumeric characters only and NOT starting with digits. 1. If SQL Server, "pdo_sqlsrv" driver is required. If you use "sqlsrv" for Doctrine (see the advanced setting [Microsoft SQL Server driver](tools.html?id=microsoft-sql-server-driver)), you need to install BOTH drivers.

In the example, the settings are:

Press "OK" to save the settings.

Set up Profile Field

The last step is to set up the **Profile field** under **Security -> User Login Options -> [User Table Fields](securitysetup.html?id=user-table-fields)**. Make sure you have set up **Profile field** or the chat feature cannot be enabled/disabled.

Now you can generate the website again.

Set up Folder Permissions

After generation, make sure the following folders exist and are **readable and writable** to the web server user: - *\/laravel/storage* - *\/laravel/public/storage* - The directory for temporary files specified by [sys_temp_dir](https://www.php.net/manual/en/filesystem.configuration.php#ini.sys-temp-dir) in your *php.ini*. Defaults to the system default (see [sys_get_temp_dir](https://www.php.net/manual/en/function.sys-get-temp-dir.php)), e.g. *C:\Windows\Temp* on Windows.

Set up Web Server (Nginx)

If you use Apache and IIS, there is no need to setup, the generated *.htaccess* and *web.config* already handle the URL rewriting for the chat app. However, if you use Nginx, you need to add the follows to your *nginx.conf*:

Start Chatting

To test the feature, go to the website, login as any user (except the hard-coded super admin). In this example, we login as "nancy".

**Note** A chat user MUST be an user **from the users table**. The hard-coded super admin and anonymous user are NOT supported.

To toggle chat feature, click the user menu at top right and select **Enable chat** or **Disable chat**:

After enabling chat, a chat button will appear at bottom right, click the button to open the chat widget. You can search users to chat with:

And begin chatting!

 

 ©2002-2025 e.World Technology Ltd. All rights reserved.