# Introduction

![](https://camo.githubusercontent.com/bab557487b660a99bfb798af064b745245747dec165c929720c589257d734233/68747470733a2f2f312e62702e626c6f6773706f742e636f6d2f2d76746d784b48387a4a79382f58677665545773454a6b492f41414141414141414137512f794b736c724f70304132776a35567772634e4646326f6f525f6633626f72337577434c63424741735948512f73313630302f556e7469746c65642d31322e706e67)

[![Latest Stable Version](https://camo.githubusercontent.com/c394e2627fe47531e92fbf044b16a89883059ece37d899e9eb3e639e68da7e35/68747470733a2f2f706f7365722e707567782e6f72672f6d756e6166696f2f636861746966792f762f737461626c65)](https://packagist.org/packages/munafio/chatify) [![Total Downloads](https://camo.githubusercontent.com/9489b37efdbbd5a54e322c2da29e09e1e71c01cf611608b98067f4199a988555/68747470733a2f2f706f7365722e707567782e6f72672f6d756e6166696f2f636861746966792f646f776e6c6f616473)](https://packagist.org/packages/munafio/chatify) [![License](https://camo.githubusercontent.com/d2d936519329b603c04e90d47bd438f952e104ce9230c53db2324ff5442fef02/68747470733a2f2f706f7365722e707567782e6f72672f6d756e6166696f2f636861746966792f6c6963656e7365)](https://packagist.org/packages/munafio/chatify)

## [Chatify](https://github.com/munafio/chatify) Laravel Package

A Laravel package that allows you to add a complete user messaging system into your new/existing Laravel application with only a few easy steps.

## Requirements

* PHP >=5.3.2.
* Laravel >=5.4
* Pusher Api Account.

## Features

![](https://camo.githubusercontent.com/40a93a5ccc32f3c0884602c6b18f28d18bb2cd96a88d6e7d1eec055794bbc80c/68747470733a2f2f312e62702e626c6f6773706f742e636f6d2f2d4b5350694c4c3374715f6f2f5867704c6d4367574175492f41414141414141414136772f6e366d346b324d43316a6f4e4d674b533656706b69322d337a3932485855765177434c63424741735948512f73313630302f53637265656e73686f7425324266726f6d253242323031392d31322d333025324232312d35392d35352e706e67)

* Users / groups(soon) chat system.
* Real-time contacts list updates.
* Favorites contacts list (Like stories style) and add to favorite button.
* Saved Messages to save your messages online like Telegram messenger app.
* Search functionality.
* Contact item's last message indicator (e.g. You: ....).
* Real-time user's active status.
* Real-time typing indicator.
* Real-time seen messages indicator.
* Real-time internet connection status.
* Upload attachments (Photo/File).
* Shared photos, delete conversation.. (User's info right side).
* Responsive design with all devices.
* User settings and chat customization : user's profile photo, dark mode and chat color. with simple and wonderful UI design.

## Demo

* [Live Demo](https://chatify-demo.munafio.com/)&#x20;

Register a new user or login using the credentials below **:**

```
email    : demo@e.com
password : demo1234
```

* Demo app - [Click Here](https://github.com/munafio/chatify-demo).
* Video on YouTube - [Click Here](https://youtu.be/gjo74FUJJPI)

## Author

[Munaf A. Mahdi](https://www.munafio.com/p/contact-me.html)

### License

[MIT](https://choosealicense.com/licenses/mit/)


# Installation

{% embed url="<https://youtu.be/fNHI002mPGc>" %}
Video Tutorial on YouTube
{% endembed %}

OR

Follow the steps below :

## **1. Install the package in your Laravel app**

**Quick Note:** If you are installing this package in a new project, make sure to install the default user authentication system provided with [Laravel](https://laravel.com/docs).

```
$ composer require munafio/chatify
```

## **2. Pusher Api Settings**

This package using Pusher Api, so you need to :

* Create account and modify `.env` file of your Laravel app with your api credentials.
* This package used a Pusher client events, and client events must be enabled for the application. You can do this in the `Settings` tab for your app within the Channels dashboard.\
  &#x20;[Read more about Pusher 'Triggering client events'](https://pusher.com/docs/channels/using_channels/events#triggering-client-events)

![](https://camo.githubusercontent.com/c4eb135c5035b0281ba187743e96bc94fb0f88920abe3cb6da5398836375961b/68747470733a2f2f312e62702e626c6f6773706f742e636f6d2f2d314e313052346838744f302f58676f42483758773535492f41414141414141414136592f4b4252472d572d5071535166687131724b4173762d423631566669517677675467434c63424741735948512f73313630302f53637265656e73686f7425324266726f6d253242323031392d31322d333025324231362d34372d30352e706e67)

## **3. Publishing Assets**

Packages' assets to be published :\
&#x20;The Important assets:

* config
* assets
* migrations

and the optional assets :

* controllers (you need to configure [this](https://github.com/munafio/chatify/#controllers-namespace), if published)
* views

to publish the assets, do the following command line with changing the tag value .. that means after `--tag=` write `chatify-` + asset name as mentioned above.\
&#x20;Example :

```
$ php artisan vendor:publish --tag=chatify-config
```

* NOTE: Publishing assets means (e.g. config) that creating a copy of the package's config file into the `config` folder of your Laravel applications and like so with the other assets (Package's Views, controllers, migrations ...).

## **4. Migrations**

Migrate the new `migrations` that added by the previous step

```
$ php artisan migrate
```

## **5. Storage Symlink**

Create a shortcut or a symlink to the `storage` folder into the `public` folder

```
$ php artisan storage:link
```

## **6. App config (Only for Laravel <=v5.4)**

For Laravel `<=v5.4` that doesn't support package auto-discovery, add the following provider into `config/app.php` providers array list :

```
...
/*
* Package Service Providers...
*/
\Chatify\ChatifyServiceProvider::class,
...
```

and the following alias into into `config/app.php` aliases:

```
...
/*
* Class Aliases
*/
'Chatify' => Chatify\Facades\ChatifyMessenger::class,
...
```

* After installing the package, you can access the messenger by the default path(route path) which is `/chatify`, and you can change path name in the config file `config/chatify.php` as mentioned in the `configurations` section.

**That's it .. Enjoy :)**


# Configurations

You can find and modify the default configurations of the package at `config/chatify.php` file that you published in the step 2 of the installation steps .. and all configurations is documented well to be understood by other developers.

* All package’s files is documented to understand the whole code.

#### Messenger Name

This value is the name of the app which is used in the views or elsewhere in the app.

```
...
'name' => env('CHATIFY_NAME', 'Chatify Messenger'),
...
```

#### Messenger Path in Your App

This value is the path of the package or in other meaning, it is the prefix of all the registered routes in this package. `e.g (yourapp.domain/chatify)`

```
...
'path' => env('CHATIFY_PATH', 'chatify'),
...
```

#### Package's web routes middleware

This value is the middleware of all routes registered in this package which is by default : `auth`.

```
...
'middleware' => env('CHATIFY_MIDDLEWARE', 'auth'),
...
```

#### Pusher API credentials

you don't need to modify the credentials of Pusher from here, because you already added your credentials in the `.env` file of your Laravel app.

#### User Avatar

This is the user's avatar setting that includes :

```
...
'user_avatar' => [
        'folder' => 'users-avatar',
        ...
    ],
...
```

which is the default folder name to upload and get user's avatar from.

```
...
'user_avatar' => [
        ...
        'default' => 'avatar.png',
    ],
...
```

which is the default avatar file name for users stored in database .. and when you publishing `assets`, a copy of the avatar photo will be copied into your storage path.

#### Attachments By Default

This array contains the important default values that used in this package :

```
...
'attachments' => [
        'folder' => 'attachments',
        ...
    ],
...
```

This is the default folder name for `attachments` in the storage which is all the attachments will be stored in .. and also going to be used in attachments urls in the views.

```
...
'attachments' => [
        ...
        'route' => 'attachments.download',
    ],
...
```

It is the route name of the `download attachments` method.

#### Controller's namespace

This property if you may need to change the namespace of the route's controllers of this package after publishing the 'controllers' asset, from the default one to your App's controllers namespace.

By default: `Chatify\Http\Controllers`\
&#x20;If published to be modified, it should be like: `App\Http\Controllers\vendor\Chatify`

```
...
'namespace' => env('CHATIFY_ROUTES_NAMESPACE', 'Chatify\Http\Controllers'),
```


# Introduction

![Chatify Laravel Package](https://camo.githubusercontent.com/bab557487b660a99bfb798af064b745245747dec165c929720c589257d734233/68747470733a2f2f312e62702e626c6f6773706f742e636f6d2f2d76746d784b48387a4a79382f58677665545773454a6b492f41414141414141414137512f794b736c724f70304132776a35567772634e4646326f6f525f6633626f72337577434c63424741735948512f73313630302f556e7469746c65642d31322e706e67)

[![Latest Stable Version](https://camo.githubusercontent.com/c394e2627fe47531e92fbf044b16a89883059ece37d899e9eb3e639e68da7e35/68747470733a2f2f706f7365722e707567782e6f72672f6d756e6166696f2f636861746966792f762f737461626c65)](https://packagist.org/packages/munafio/chatify) [![Total Downloads](https://camo.githubusercontent.com/9489b37efdbbd5a54e322c2da29e09e1e71c01cf611608b98067f4199a988555/68747470733a2f2f706f7365722e707567782e6f72672f6d756e6166696f2f636861746966792f646f776e6c6f616473)](https://packagist.org/packages/munafio/chatify) [![License](https://camo.githubusercontent.com/d2d936519329b603c04e90d47bd438f952e104ce9230c53db2324ff5442fef02/68747470733a2f2f706f7365722e707567782e6f72672f6d756e6166696f2f636861746966792f6c6963656e7365)](https://packagist.org/packages/munafio/chatify)

[**Chatify**](https://github.com/munafio/chatify) is a Laravel package helps you add a complete real-time messaging system to your new / existing application with only one command.

## Prerequisites

* PHP >=5.3.2.
* Laravel >=5.4
* Pusher Api Account.

## Features

![](https://camo.githubusercontent.com/40a93a5ccc32f3c0884602c6b18f28d18bb2cd96a88d6e7d1eec055794bbc80c/68747470733a2f2f312e62702e626c6f6773706f742e636f6d2f2d4b5350694c4c3374715f6f2f5867704c6d4367574175492f41414141414141414136772f6e366d346b324d43316a6f4e4d674b533656706b69322d337a3932485855765177434c63424741735948512f73313630302f53637265656e73686f7425324266726f6d253242323031392d31322d333025324232312d35392d35352e706e67)

* Users / groups(soon with v2) chat system.
* Real-time contacts list updates.
* Favorites contacts list (Like stories style) and add to favorite button.
* Saved Messages to save your messages online like Telegram messenger app.
* Search functionality.
* Contact item's last message indicator (e.g. You: ....).
* Real-time user's active status.
* Real-time typing indicator.
* Real-time seen messages indicator.
* Real-time internet connection status.
* Upload attachments (Photo/File).
* Shared photos, delete conversation.. (User's info right side).
* Responsive design with all devices.
* User settings and chat customization : user's profile photo, dark mode and chat color. with simple and wonderful UI design.

## Demo

* [Live Demo](https://chatify-demo.munafio.com/)&#x20;

Register a new user or login using the credentials below **:**

```
email    : demo@e.com
password : demo1234
```

* Demo app - [Click Here](https://github.com/munafio/chatify-demo).
* Video on YouTube - [Click Here](https://youtu.be/gjo74FUJJPI).

## Author

[Munaf A. Mahdi](https://www.munafio.com/p/contact-me.html)

### License

[MIT](https://choosealicense.com/licenses/mit/)


# Installation

{% embed url="<https://youtu.be/WTfDDy_-doA>" %}

OR

Follow the steps below :

## **1. Pusher Account and it's settings**

This package uses Pusher Api, so you need to :

* Create account and modify `.env` file of your Laravel app with your Pusher api credentials.
* This package uses Pusher's **client events**, and client events must be enabled for the application. You can do this in the `Settings` tab for your app within the Channels dashboard.\
  &#x20;[Read more about Pusher 'Triggering client events'](https://pusher.com/docs/channels/using_channels/events#triggering-client-events)

![](/files/-MaoTn4pQ_W2o0o_0P5C)

## **2. Require Chatify in your application**

**Quick Note:** If you are installing this package in a new project, make sure to install the default user authentication system provided with [Laravel](https://laravel.com/docs).

```bash
$ composer require munafio/chatify
```

## **3. Install Chatify**

All you need is to run the following command to setup everything for you:

```bash
$ php artisan chatify:install
```

This command will automatically do the following:

* Some configurations.
* Publishing the assets (config, views, assets, models, migrations)
* Storage symlink

## 4. Migration to database

```
$ php artisan migrate
```

## **5. App config (Only for Laravel <=v5.4)**

Only for applications that runs Laravel `<=v5.4` that doesn't support package **auto-discovery**, add the following provider into `config/app.php` providers array list :

{% code title="config/app.php" %}

```php
...
/*
* Package Service Providers...
*/
\Chatify\ChatifyServiceProvider::class,
...
```

{% endcode %}

and the following **alias** into into `config/app.php` **aliases**:

{% code title="config/app.php" %}

```php
...
/*
* Class Aliases
*/
'Chatify' => Chatify\Facades\ChatifyMessenger::class,
...
```

{% endcode %}

* After installing the package, you can access the messenger by the default path(routes prefix) which is `/chatify`, and you can change path name in the config file `config/chatify.php` as mentioned in the `configurations` below.

**That's it .. Enjoy :)**


# Configurations

You can find package's configuration file at `config/chatify.php` in your application, and will find the following properties that you can modify inside it:

## Display Name

This value is the name for the messenger displayed in the UI

```php
'name' => env('CHATIFY_NAME', 'Chatify Messenger'),
```

## Routes' Configurations

This value is package's routes' configurations&#x20;

```php
'routes' => [
    'prefix' => env('CHATIFY_ROUTES_PREFIX', 'chatify'),
    'middleware' => env('CHATIFY_ROUTES_MIDDLEWARE', ['web','auth']),
    'namespace' => env('CHATIFY_ROUTES_NAMESPACE', 'Chatify\Http\Controllers'),
],
```

* `prefix` is the prefix of the routes in this package, so you can access the messenger from this value by going to `/chatify`.
* `middleware` is the middleware array applied on the routes of this package.
* `namespace` is the routes' controllers namespace.

## Pusher configurations

From here you can change pusher's configurations,

```php
'pusher' => [
    'key' => env('PUSHER_APP_KEY'),
    'secret' => env('PUSHER_APP_SECRET'),
    'app_id' => env('PUSHER_APP_ID'),
    'options' => (array) [
        'cluster' => env('PUSHER_APP_CLUSTER'),
        'useTLS' => env('PUSHER_APP_USETLS'),
    ],
],
```

## User Avatar

This is user's avatar configurations

```php
'user_avatar' => [
    'folder' => 'users-avatar',
    'default' => 'avatar.png',
],
```

* `folder` is the default folder name located in the storage to store **users' avatars** in.
* `default` is the default user avatar image, before uploading a new one.

## Attachments

This is attachments configurations

```php
'attachments' => [
    'folder' => 'attachments',
    'download_route_name' => 'attachments.download',
    'allowed_images' => (array) ['png','jpg','jpeg','gif'],
    'allowed_files' => (array) ['zip','rar','txt'],
],
```

* `folder` is the default folder name located in the storage to store **attachments** in.
* `download_route_name` is name of the route to download the attachments.
* `allowed_images` is the default allowed images to be uploaded.
* `allowed_files` is the default allowed files to be uploaded.


# Customizations

This package allows you to customize almost everything, the controllers, models, views, assets, configurations ... like so.

So you have the full control on the package to do what ever you want, all you need is to publish the required asset  (e.g. controllers) to start your modifications on it.

## Package's assets

* `config`
* `views`
* `assets` (js, css, imgs)
* `models`
* `migrations`
* `controllers`

{% hint style="info" %}
The following assets already been published during the installation process:

`config`, `views`, `assets`, `models`, `migrations`

only the `controllers` asset is not published until you do.
{% endhint %}

## Publishing the assets

When you need to publish an asset, all you need is to run the following command :

```
php artisan vendor:publish --tag=chatify-<asset-name>
```

{% hint style="info" %}
Change`<asset-name>` with the required asset name (e.g. config) to be like `chatify-config`
{% endhint %}

## Controllers

You may want to do some modifications on the controllers of this package, so you need to follow the steps below:

1. Publish `controllers` asset

```
php artisan vendor:publish --tag=chatify-controllers
```

2\. Go to `config/chatify.php` and from `routes` properties, change `namespace` to `App\Http\Controllers\vendor\Chatify` to be like the following:

{% code title="config/chatify.php" %}

```php
...
'namespace' => env('CHATIFY_ROUTES_NAMESPACE', 'App\Http\Controllers\vendor\Chatify'),
```

{% endcode %}

3\. Go to `app/Http/Controllers/vendor/Chatify` and open `MessagesController.php` with your code editor .. then change the namespace to the same namespace specified in the step 2 above.

Thats all you need to do.

Now, You can work with package's controller and start your modifications.


# Upgrading Chatify

When upgrading to a new version of Chatify, it's important that you carefully review [the upgrade guide](https://github.com/munafio/chatify/blob/master/UPGRADE.md).

In addition, when upgrading to any new Chatify version, you should re-publish Chatify's assets:

```
php artisan chatify:publish
```

To keep the assets **up-to-date** and avoid issues in future updates, you may add the `chatify:publish` command to the `post-update-cmd` scripts in your application's `composer.json` file:

{% code title="composer.json" %}

```javascript
{
    "scripts": {
        "post-update-cmd": [
            "@php artisan chatify:publish --ansi"
        ]
    }
}
```

{% endcode %}


# Notes

## Need a help?

I have created a server for **Chatify** on `Discord` to let you **up-to-date** and help you as much as I can ..&#x20;

so now you can chat with me, get a help, showcases, and most importantly to get announcements and updates about **Chatify**.&#x20;

So, [join now](https://discord.gg/RaxyKVykYJ) and keep updated.

## Groups feature

Soon will talk about this here.. check it back later.


# Introduction

![Chatify Laravel Package](https://camo.githubusercontent.com/bab557487b660a99bfb798af064b745245747dec165c929720c589257d734233/68747470733a2f2f312e62702e626c6f6773706f742e636f6d2f2d76746d784b48387a4a79382f58677665545773454a6b492f41414141414141414137512f794b736c724f70304132776a35567772634e4646326f6f525f6633626f72337577434c63424741735948512f73313630302f556e7469746c65642d31322e706e67)

[![Latest Stable Version](https://camo.githubusercontent.com/c394e2627fe47531e92fbf044b16a89883059ece37d899e9eb3e639e68da7e35/68747470733a2f2f706f7365722e707567782e6f72672f6d756e6166696f2f636861746966792f762f737461626c65)](https://packagist.org/packages/munafio/chatify) [![Total Downloads](https://camo.githubusercontent.com/9489b37efdbbd5a54e322c2da29e09e1e71c01cf611608b98067f4199a988555/68747470733a2f2f706f7365722e707567782e6f72672f6d756e6166696f2f636861746966792f646f776e6c6f616473)](https://packagist.org/packages/munafio/chatify) [![License](https://camo.githubusercontent.com/d2d936519329b603c04e90d47bd438f952e104ce9230c53db2324ff5442fef02/68747470733a2f2f706f7365722e707567782e6f72672f6d756e6166696f2f636861746966792f6c6963656e7365)](https://packagist.org/packages/munafio/chatify)

[**Chatify**](https://github.com/munafio/chatify) is a Laravel package helps you add a complete real-time messaging system to your new / existing application with only one command.

## Prerequisites

* PHP >=5.3.2.
* Laravel >=5.4
* Pusher Api Account.

## Features

![](https://camo.githubusercontent.com/40a93a5ccc32f3c0884602c6b18f28d18bb2cd96a88d6e7d1eec055794bbc80c/68747470733a2f2f312e62702e626c6f6773706f742e636f6d2f2d4b5350694c4c3374715f6f2f5867704c6d4367574175492f41414141414141414136772f6e366d346b324d43316a6f4e4d674b533656706b69322d337a3932485855765177434c63424741735948512f73313630302f53637265656e73686f7425324266726f6d253242323031392d31322d333025324232312d35392d35352e706e67)

* Users chat system.
* Real-time contacts list updates.
* Favorites contacts list (Like stories style) and add to favorite button.
* Saved Messages to save your messages online like Telegram messenger app.
* Search functionality.
* Contact item's last message indicator (e.g. You: ....).
* Real-time user's active status.
* Real-time typing indicator.
* Real-time seen messages indicator.
* Real-time internet connection status.
* Upload attachments (Photo/File).
* Shared photos, delete conversation.. (User's info right side).
* Responsive design with all devices.
* User settings and chat customization : user's profile photo, dark mode and chat color. with simple and wonderful UI design.

## Demo

* [Live Demo](https://chatify-demo.munafio.com/)&#x20;

Register a new user or login using the credentials below **:**

```
email    : demo@e.com
password : demo1234
```

* Demo app - [Click Here](https://github.com/munafio/chatify-demo).
* Video on YouTube - [Click Here](https://youtu.be/gjo74FUJJPI).

## Author

[Munaf A. Mahdi](https://www.munafio.com/p/contact-me.html)

### License

[MIT](https://choosealicense.com/licenses/mit/)


# Installation

{% embed url="<https://youtu.be/WTfDDy_-doA>" %}

OR

Follow the steps below :

## **1. Pusher Account and it's settings**

This package uses Pusher Api, so you need to :

* Create account and modify `.env` file of your Laravel app with your Pusher api credentials.
* This package uses Pusher's **client events**, and client events must be enabled for the application. You can do this in the `Settings` tab for your app within the Channels dashboard.\
  &#x20;[Read more about Pusher 'Triggering client events'](https://pusher.com/docs/channels/using_channels/events#triggering-client-events)

![](/files/-MaoTn4pQ_W2o0o_0P5C)

## **2. Require Chatify in your application**

**Quick Note:** If you are installing this package in a new project, make sure to install the default user authentication system provided with [Laravel](https://laravel.com/docs).

```bash
$ composer require munafio/chatify
```

## **3. Install Chatify**

All you need is to run the following command to setup everything for you:

```bash
$ php artisan chatify:install
```

This command will automatically do the following:

* Some configurations.
* Publishing the assets (config, views, assets, models, migrations)
* Storage symlink

## 4. Migration to database

```
$ php artisan migrate
```

## **5. App config (Only for Laravel <=v5.4)**

Only for applications that runs Laravel `<=v5.4` that doesn't support package **auto-discovery**, add the following provider into `config/app.php` providers array list :

{% code title="config/app.php" %}

```php
...
/*
* Package Service Providers...
*/
\Chatify\ChatifyServiceProvider::class,
...
```

{% endcode %}

and the following **alias** into into `config/app.php` **aliases**:

{% code title="config/app.php" %}

```php
...
/*
* Class Aliases
*/
'Chatify' => Chatify\Facades\ChatifyMessenger::class,
...
```

{% endcode %}

* After installing the package, you can access the messenger by the default path(routes prefix) which is `/chatify`, and you can change path name in the config file `config/chatify.php` as mentioned in the `configurations` below.

**That's it .. Enjoy :)**


# Configurations

You can find package's configuration file at `config/chatify.php` in your application, and will find the following properties that you can modify inside it:

## Display Name

This value is the name for the messenger displayed in the UI

```php
'name' => env('CHATIFY_NAME', 'Chatify Messenger'),
```

## Routes' Configurations

This value is package's routes' configurations&#x20;

```php
'routes' => [
    'prefix' => env('CHATIFY_ROUTES_PREFIX', 'chatify'),
    'middleware' => env('CHATIFY_ROUTES_MIDDLEWARE', ['web','auth']),
    'namespace' => env('CHATIFY_ROUTES_NAMESPACE', 'Chatify\Http\Controllers'),
],
```

* `prefix` is the prefix of the routes in this package, so you can access the messenger from this value by going to `/chatify`.
* `middleware` is the middleware array applied on the routes of this package.
* `namespace` is the routes' controllers namespace.

### API Routes'

```php
'api_routes' => [
    'prefix' => env('CHATIFY_API_ROUTES_PREFIX', 'chatify'),
    'middleware' => env('CHATIFY_API_ROUTES_MIDDLEWARE', ['api']),
    'namespace' => env('CHATIFY_API_ROUTES_NAMESPACE', 'Chatify\Http\Controllers\Api'),
],
```

## Pusher configurations

From here you can change pusher's configurations,

```php
'pusher' => [
    'key' => env('PUSHER_APP_KEY'),
    'secret' => env('PUSHER_APP_SECRET'),
    'app_id' => env('PUSHER_APP_ID'),
    'options' => (array) [
        'cluster' => env('PUSHER_APP_CLUSTER'),
        'useTLS' => env('PUSHER_APP_USETLS'),
    ],
],
```

## User Avatar

This is user's avatar configurations

```php
'user_avatar' => [
    'folder' => 'users-avatar',
    'default' => 'avatar.png',
],
```

* `folder` is the default folder name located in the storage to store **users' avatars** in.
* `default` is the default user avatar image, before uploading a new one.

## Attachments

This is attachments configurations

```php
'attachments' => [
    'folder' => 'attachments',
    'download_route_name' => 'attachments.download',
    'allowed_images' => (array) ['png','jpg','jpeg','gif'],
    'allowed_files' => (array) ['zip','rar','txt'],
    'max_upload_size' => 150, // MB
],
```

* `folder` is the default folder name located in the storage to store **attachments** in.
* `download_route_name` is name of the route to download the attachments.
* `allowed_images` is the default allowed images to be uploaded.
* `allowed_files` is the default allowed files to be uploaded.
* \`max\_upload\_size\` is the max file size allowed to be uploaded in the backend (e.g. message attachment, user avatar..).

## Messenger Colors

```php
/*
|-------------------------------------
| Messenger's colors
|-------------------------------------
*/
'colors' => (array) [
    '#2180f3',
    '#2196F3',
    '#00BCD4',
    '#3F51B5',
    '#673AB7',
    '#4CAF50',
    '#FFC107',
    '#FF9800',
    '#ff2522',
    '#9C27B0',
],
```

From the `colors` property you can set messenger's colors that users can change from the settings of their profile.

By default, there are **`10`** default colors as above.


# Customizations

You may want to do your own customizations and modifications on the code such as the `views` or the `controllers` to add a new feature for example ... etc. so, all you need is to publish the required `asset` mentioned below and start your own customizations!

## Package's assets

* `config`
* `views`
* `assets` (js, css, imgs)
* `models`
* `migrations`
* `controllers`

{% hint style="info" %}
The following assets already been published during the installation process:

`config`, `views`, `assets`, `models`, `migrations`

only the `controllers` asset is not published until you do.
{% endhint %}

### Publishing the assets

When you need to publish an asset, all you need is to run the following command :

```
php artisan vendor:publish --tag=chatify-<asset-name>
```

{% hint style="info" %}
Change`<asset-name>` with the required asset name (e.g. config) to be like `chatify-config`
{% endhint %}

### Controllers

You may want to do some modifications on the controllers of this package, so you need to follow the steps below:

1. Publish `controllers` asset

```
php artisan vendor:publish --tag=chatify-controllers
```

2\. Go to `config/chatify.php` and from `routes` properties, change `namespace` to `App\Http\Controllers\vendor\Chatify` to be like the following:

{% code title="config/chatify.php" %}

```php
...
'namespace' => env('CHATIFY_ROUTES_NAMESPACE', 'App\Http\Controllers\vendor\Chatify'),
```

{% endcode %}

same for `api_routes`, change the `namespace` to `App\Http\Controllers\vendor\Chatify\Api`&#x20;

{% code title="config/chatify.php" %}

```php
... 
'namespace' => env('CHATIFY_API_ROUTES_NAMESPACE', 'App\Http\Controllers\vendor\Chatify\Api').
```

{% endcode %}

3\. Go to `app/Http/Controllers/vendor/Chatify` and open `MessagesController.php` with your code editor .. then change the namespace to the same namespace specified in the step 2 above ..&#x20;

the same for `Api\MessagesController.php` .

Thats all you need to do.

Now, You can work with package's controller and start your modifications.

## Others

other customization such as

* Messenger name.
* Messenger colors.
* Messenger Max upload size.
* Messenger avatar.

&#x20;can be done by the [configurations](https://chatify.munafio.com/configurations) section.


# APIs

## APIs Postman Collection

Using [Postman](https://www.getpostman.com), open the application then click on `import` button .. then from the `Link` tab, paste the link below in:

<https://www.getpostman.com/collections/b910218741ea17d8e22b>


# Upgrading Chatify

When upgrading to a new version of Chatify, it's important that you carefully review [the upgrade guide](https://github.com/munafio/chatify/blob/master/UPGRADE.md).

In addition, when upgrading to any new Chatify version, you should re-publish Chatify's assets:

```
php artisan chatify:publish
```

To keep the assets **up-to-date** and avoid issues in future updates, you may add the `chatify:publish` command to the `post-update-cmd` scripts in your application's `composer.json` file:

{% code title="composer.json" %}

```javascript
{
    "scripts": {
        "post-update-cmd": [
            "@php artisan chatify:publish --ansi"
        ]
    }
}
```

{% endcode %}


# Notes

## Need a help?

I have created a server for **Chatify** on `Discord` to let you **up-to-date** and help you as much as I can ..&#x20;

so now you can chat with me, get a help, showcases, and most importantly to get announcements and updates about **Chatify**.&#x20;

So, [join now](https://discord.gg/RaxyKVykYJ) and keep updated.

## Groups feature

Soon will talk about this here.. check it back later.


# Introduction

![Chatify Laravel Package](https://camo.githubusercontent.com/bab557487b660a99bfb798af064b745245747dec165c929720c589257d734233/68747470733a2f2f312e62702e626c6f6773706f742e636f6d2f2d76746d784b48387a4a79382f58677665545773454a6b492f41414141414141414137512f794b736c724f70304132776a35567772634e4646326f6f525f6633626f72337577434c63424741735948512f73313630302f556e7469746c65642d31322e706e67)

[![Latest Stable Version](https://camo.githubusercontent.com/c394e2627fe47531e92fbf044b16a89883059ece37d899e9eb3e639e68da7e35/68747470733a2f2f706f7365722e707567782e6f72672f6d756e6166696f2f636861746966792f762f737461626c65)](https://packagist.org/packages/munafio/chatify) [![Total Downloads](https://camo.githubusercontent.com/9489b37efdbbd5a54e322c2da29e09e1e71c01cf611608b98067f4199a988555/68747470733a2f2f706f7365722e707567782e6f72672f6d756e6166696f2f636861746966792f646f776e6c6f616473)](https://packagist.org/packages/munafio/chatify) [![License](https://camo.githubusercontent.com/d2d936519329b603c04e90d47bd438f952e104ce9230c53db2324ff5442fef02/68747470733a2f2f706f7365722e707567782e6f72672f6d756e6166696f2f636861746966792f6c6963656e7365)](https://packagist.org/packages/munafio/chatify)

[**Chatify**](https://github.com/munafio/chatify) is a Laravel package helps you add a complete real-time messaging system to your new / existing application with only one command.

## Prerequisites

* PHP >=5.3.2.
* Laravel >=5.4
* Pusher Api Account.

## Features

![](https://camo.githubusercontent.com/40a93a5ccc32f3c0884602c6b18f28d18bb2cd96a88d6e7d1eec055794bbc80c/68747470733a2f2f312e62702e626c6f6773706f742e636f6d2f2d4b5350694c4c3374715f6f2f5867704c6d4367574175492f41414141414141414136772f6e366d346b324d43316a6f4e4d674b533656706b69322d337a3932485855765177434c63424741735948512f73313630302f53637265656e73686f7425324266726f6d253242323031392d31322d333025324232312d35392d35352e706e67)

* Users chat system.
* Real-time contacts list updates.
* Favorites contacts list (Like stories style) and add to favorite button.
* Saved Messages to save your messages online like Telegram messenger app.
* Search functionality.
* Contact item's last message indicator (e.g. You: ....).
* Real-time user's active status.
* Real-time typing indicator.
* Real-time seen messages indicator.
* Real-time internet connection status.
* Upload attachments (Photo/File).
* Shared photos, delete conversation.. (User's info right side).
* Responsive design with all devices.
* User settings and chat customization : user's profile photo, dark mode and chat color. with simple and wonderful UI design.

## Demo

* [Live Demo](https://chatify-demo.munafio.com/)&#x20;

Register a new user or login using the credentials below **:**

```
email    : demo@e.com
password : demo1234
```

* Demo app - [Click Here](https://github.com/munafio/chatify-demo).
* Video on YouTube - [Click Here](https://youtu.be/gjo74FUJJPI).

## Author

[Munaf A. Mahdi](https://www.munafio.com/p/contact-me.html)

### License

[MIT](https://choosealicense.com/licenses/mit/)


# Installation

{% embed url="<https://youtu.be/WTfDDy_-doA>" %}

OR

Follow the steps below :

## **1. Pusher Account and it's settings**

This package uses Pusher Api, so you need to :

* Create account and modify `.env` file of your Laravel app with your Pusher api credentials.
* This package uses Pusher's **client events**, and client events must be enabled for the application. You can do this in the `Settings` tab for your app within the Channels dashboard.\
  &#x20;[Read more about Pusher 'Triggering client events'](https://pusher.com/docs/channels/using_channels/events#triggering-client-events)

![](/files/-MaoTn4pQ_W2o0o_0P5C)

## **2. Require Chatify in your application**

**Quick Note:** If you are installing this package in a new project, make sure to install the default user authentication system provided with [Laravel](https://laravel.com/docs).

```bash
$ composer require munafio/chatify
```

## **3. Install Chatify**

All you need is to run the following command to setup everything for you:

```bash
$ php artisan chatify:install
```

This command will automatically do the following:

* Some configurations.
* Publishing the assets (config, views, assets, models, migrations)
* Storage symlink

## 4. Migration to database

```
$ php artisan migrate
```

## **5. App config (Only for Laravel <=v5.4)**

Only for applications that runs Laravel `<=v5.4` that doesn't support package **auto-discovery**, add the following provider into `config/app.php` providers array list :

{% code title="config/app.php" %}

```php
...
/*
* Package Service Providers...
*/
\Chatify\ChatifyServiceProvider::class,
...
```

{% endcode %}

and the following **alias** into into `config/app.php` **aliases**:

{% code title="config/app.php" %}

```php
...
/*
* Class Aliases
*/
'Chatify' => Chatify\Facades\ChatifyMessenger::class,
...
```

{% endcode %}

* After installing the package, you can access the messenger by the default path(routes prefix) which is `/chatify`, and you can change path name in the config file `config/chatify.php` as mentioned in the `configurations` below.

**That's it .. Enjoy :)**


# Configurations

You can find package's configuration file at `config/chatify.php` in your application, and will find the following properties that you can modify inside it:

## Display Name

This value is the name for the messenger displayed in the UI

```php
'name' => env('CHATIFY_NAME', 'Chatify Messenger'),
```

## Storage Disk

The disk on which to store uploaded files and derived images by default. [More details](https://laravel.com/docs/filesystem)

```php
'storage_disk_name' => env('CHATIFY_STORAGE_DISK', 'public'),
```

## Routes' Configurations

This value is package's routes' configurations&#x20;

```php
'routes' => [
    'prefix' => env('CHATIFY_ROUTES_PREFIX', 'chatify'),
    'middleware' => env('CHATIFY_ROUTES_MIDDLEWARE', ['web','auth']),
    'namespace' => env('CHATIFY_ROUTES_NAMESPACE', 'Chatify\Http\Controllers'),
],
```

* `prefix` is the prefix of the routes in this package, so you can access the messenger from this value by going to `/chatify`.
* `middleware` is the middleware array applied on the routes of this package.
* `namespace` is the routes' controllers namespace.

### API Routes'

```php
'api_routes' => [
    'prefix' => env('CHATIFY_API_ROUTES_PREFIX', 'chatify'),
    'middleware' => env('CHATIFY_API_ROUTES_MIDDLEWARE', ['api']),
    'namespace' => env('CHATIFY_API_ROUTES_NAMESPACE', 'Chatify\Http\Controllers\Api'),
],
```

## Pusher configurations

From here you can change pusher's configurations,

```php
'pusher' => [
    'key' => env('PUSHER_APP_KEY'),
    'secret' => env('PUSHER_APP_SECRET'),
    'app_id' => env('PUSHER_APP_ID'),
    'options' => (array) [
        'cluster' => env('PUSHER_APP_CLUSTER'),
        'useTLS' => env('PUSHER_APP_USETLS'),
    ],
],
```

## User Avatar

This is user's avatar configurations

```php
'user_avatar' => [
    'folder' => 'users-avatar',
    'default' => 'avatar.png',
],
```

* `folder` is the default folder name located in the storage to store **users' avatars** in.
* `default` is the default user avatar image name, before uploading a new one.

## Gravatar

In this version (v1.4.x +) we add support for [Gravatar](https://Gravatar.com), so now you can use he default user avatar which is by default, or enable **Gravatar** to use it over the default

```php
'gravatar' => [
    'enabled' => true,
    'image_size' => 200,
    'imageset' => 'identicon'
],
```

* `enabled` set to `true` if you want to enable **Gravatar** over the default user avatar.
* `image_size` the size of user avatar generated from Gravatar.
* `imageset` Default imageset to use from the options bellow:
  * &#x20;`404`
  * `mp`
  * `identicon` (default)
  * `monsterid`
  * `wavatar`

## Attachments

This is attachments configurations

```php
'attachments' => [
    'folder' => 'attachments',
    'download_route_name' => 'attachments.download',
    'allowed_images' => (array) ['png','jpg','jpeg','gif'],
    'allowed_files' => (array) ['zip','rar','txt'],
    'max_upload_size' => 150, // MB
],
```

* `folder` is the default folder name located in the storage to store **attachments** in.
* `download_route_name` is name of the route to download the attachments.
* `allowed_images` is the default allowed images to be uploaded.
* `allowed_files` is the default allowed files to be uploaded.
* \`max\_upload\_size\` is the max file size allowed to be uploaded in the backend (e.g. message attachment, user avatar..).

## Messenger Colors

```php
/*
|-------------------------------------
| Messenger's colors
|-------------------------------------
*/
'colors' => (array) [
    '#2180f3',
    '#2196F3',
    '#00BCD4',
    '#3F51B5',
    '#673AB7',
    '#4CAF50',
    '#FFC107',
    '#FF9800',
    '#ff2522',
    '#9C27B0',
],
```

From the `colors` property you can set messenger's colors that users can change from the settings of their profile.

By default, there are **`10`** default colors as above.


# Customizations

You may want to do your own customizations and modifications on the code such as the `views` or the `controllers` to add a new feature for example ... etc. so, all you need is to publish the required `asset` mentioned below and start your own customizations!

## Package's assets

* `config`
* `views`
* `assets` (js, css, imgs)
* `models`
* `migrations`
* `controllers`

{% hint style="info" %}
The following assets already been published during the installation process:

`config`, `views`, `assets`, `models`, `migrations`

only the `controllers` asset is not published until you do.
{% endhint %}

### Publishing the assets

When you need to publish an asset, all you need is to run the following command :

```
php artisan vendor:publish --tag=chatify-<asset-name>
```

{% hint style="info" %}
Change`<asset-name>` with the required asset name (e.g. config) to be like `chatify-config`
{% endhint %}

### Controllers

You may want to do some modifications on the controllers of this package, so you need to follow the steps below:

1. Publish `controllers` asset

```
php artisan vendor:publish --tag=chatify-controllers
```

2\. Go to `config/chatify.php` and from `routes` properties, change `namespace` to `App\Http\Controllers\vendor\Chatify` to be like the following:

{% code title="config/chatify.php" %}

```php
...
'namespace' => env('CHATIFY_ROUTES_NAMESPACE', 'App\Http\Controllers\vendor\Chatify'),
```

{% endcode %}

same for `api_routes`, change the `namespace` to `App\Http\Controllers\vendor\Chatify\Api`&#x20;

{% code title="config/chatify.php" %}

```php
... 
'namespace' => env('CHATIFY_API_ROUTES_NAMESPACE', 'App\Http\Controllers\vendor\Chatify\Api').
```

{% endcode %}

3\. Go to `app/Http/Controllers/vendor/Chatify` and open `MessagesController.php` with your code editor .. then change the namespace to the same namespace specified in the step 2 above ..&#x20;

the same for `Api\MessagesController.php` .

Thats all you need to do.

Now, You can work with package's controller and start your modifications.

## Others

other customization such as

* Messenger name.
* Messenger colors.
* Messenger Max upload size.
* Messenger avatar.

&#x20;can be done by the [configurations](https://chatify.munafio.com/configurations) section.


# APIs

## APIs Postman Collection

Using [Postman](https://www.getpostman.com), open the application then click on `import` button .. then from the `Link` tab, paste the link below in:

<https://www.getpostman.com/collections/b910218741ea17d8e22b>


# Upgrading Chatify

When upgrading to a new version of Chatify, it's important that you carefully review [the upgrade guide](https://github.com/munafio/chatify/blob/master/UPGRADE.md).

In addition, when upgrading to any new Chatify version, you should re-publish Chatify's assets:

```
php artisan chatify:publish
```

To keep the assets **up-to-date** and avoid issues in future updates, you may add the `chatify:publish` command to the `post-update-cmd` scripts in your application's `composer.json` file:

{% code title="composer.json" %}

```javascript
{
    "scripts": {
        "post-update-cmd": [
            "@php artisan chatify:publish --ansi"
        ]
    }
}
```

{% endcode %}


# Notes

## Need a help?

I have created a server for **Chatify** on `Discord` to let you **up-to-date** and help you as much as I can ..&#x20;

so now you can chat with me, get a help, showcases, and most importantly to get announcements and updates about **Chatify**.&#x20;

So, [join now](https://discord.gg/RaxyKVykYJ) and keep updated.

## Groups feature

Soon will talk about this here.. check it back later.


# Introduction

![Chatify Laravel Package](https://camo.githubusercontent.com/bab557487b660a99bfb798af064b745245747dec165c929720c589257d734233/68747470733a2f2f312e62702e626c6f6773706f742e636f6d2f2d76746d784b48387a4a79382f58677665545773454a6b492f41414141414141414137512f794b736c724f70304132776a35567772634e4646326f6f525f6633626f72337577434c63424741735948512f73313630302f556e7469746c65642d31322e706e67)

[![Latest Stable Version](https://camo.githubusercontent.com/c394e2627fe47531e92fbf044b16a89883059ece37d899e9eb3e639e68da7e35/68747470733a2f2f706f7365722e707567782e6f72672f6d756e6166696f2f636861746966792f762f737461626c65)](https://packagist.org/packages/munafio/chatify) [![Total Downloads](https://camo.githubusercontent.com/9489b37efdbbd5a54e322c2da29e09e1e71c01cf611608b98067f4199a988555/68747470733a2f2f706f7365722e707567782e6f72672f6d756e6166696f2f636861746966792f646f776e6c6f616473)](https://packagist.org/packages/munafio/chatify) [![License](https://camo.githubusercontent.com/d2d936519329b603c04e90d47bd438f952e104ce9230c53db2324ff5442fef02/68747470733a2f2f706f7365722e707567782e6f72672f6d756e6166696f2f636861746966792f6c6963656e7365)](https://packagist.org/packages/munafio/chatify)

[**Chatify**](https://github.com/munafio/chatify) is a Laravel package helps you add a complete real-time messaging system to your new / existing application with only one command.

## Prerequisites

* PHP >=5.3.2.
* Laravel >=5.4
* Pusher Api Account.

## Features

![](https://camo.githubusercontent.com/40a93a5ccc32f3c0884602c6b18f28d18bb2cd96a88d6e7d1eec055794bbc80c/68747470733a2f2f312e62702e626c6f6773706f742e636f6d2f2d4b5350694c4c3374715f6f2f5867704c6d4367574175492f41414141414141414136772f6e366d346b324d43316a6f4e4d674b533656706b69322d337a3932485855765177434c63424741735948512f73313630302f53637265656e73686f7425324266726f6d253242323031392d31322d333025324232312d35392d35352e706e67)

* Users chat system.
* Real-time contacts list updates.
* Favorites contacts list (Like stories style) and add to favorite button.
* Saved Messages to save your messages online like Telegram messenger app.
* Search functionality.
* Contact item's last message indicator (e.g. You: ....).
* Real-time user's active status.
* Real-time typing indicator.
* Real-time seen messages indicator.
* Real-time internet connection status.
* Upload attachments (Photo/File).
* Shared photos, delete conversation.. (User's info right side).
* Responsive design with all devices.
* User settings and chat customization : user's profile photo, dark mode and chat color. with simple and wonderful UI design.

## Demo

* Live Demo **`(Currently not available)`**

Register a new user or login using the credentials below **:**

```
email    : demo@e.com
password : demo1234
```

* Demo app - [Click Here](https://github.com/munafio/chatify-demo).
* Video on YouTube - [Click Here](https://youtu.be/gjo74FUJJPI).

## Author

[Munaf A. Mahdi](https://www.munafio.com/p/contact-me.html)

### License

[MIT](https://choosealicense.com/licenses/mit/)


# Installation

{% embed url="<https://youtu.be/WTfDDy_-doA>" %}

OR

Follow the steps below :

## **1. Pusher Account and it's settings**

This package uses Pusher Api, so you need to :

* Create account and modify `.env` file of your Laravel app with your Pusher api credentials.
* This package uses Pusher's **client events**, and client events must be enabled for the application. You can do this in the `Settings` tab for your app within the Channels dashboard.\
  &#x20;[Read more about Pusher 'Triggering client events'](https://pusher.com/docs/channels/using_channels/events#triggering-client-events)

![](/files/-MaoTn4pQ_W2o0o_0P5C)

## **2. Require Chatify in your application**

**Quick Note:** If you are installing this package in a new project, make sure to install the default user authentication system provided with [Laravel](https://laravel.com/docs).

```bash
$ composer require munafio/chatify
```

## **3. Install Chatify**

All you need is to run the following command to setup everything for you:

```bash
$ php artisan chatify:install
```

This command will automatically do the following:

* Some configurations.
* Publishing the assets (config, views, assets, models, migrations)
* Storage symlink

## 4. Migration to database

```
$ php artisan migrate
```

## **5. App config (Only for Laravel <=v5.4)**

Only for applications that runs Laravel `<=v5.4` that doesn't support package **auto-discovery**, add the following provider into `config/app.php` providers array list :

{% code title="config/app.php" %}

```php
...
/*
* Package Service Providers...
*/
\Chatify\ChatifyServiceProvider::class,
...
```

{% endcode %}

and the following **alias** into into `config/app.php` **aliases**:

{% code title="config/app.php" %}

```php
...
/*
* Class Aliases
*/
'Chatify' => Chatify\Facades\ChatifyMessenger::class,
...
```

{% endcode %}

* After installing the package, you can access the messenger by the default path(routes prefix) which is `/chatify`, and you can change path name in the config file `config/chatify.php` as mentioned in the `configurations` below.

**That's it .. Enjoy :)**


# Configurations

You can find package's configuration file at `config/chatify.php` in your application, and will find the following properties that you can modify inside it:

## Display Name

This value is the name for the messenger displayed in the UI

```php
'name' => env('CHATIFY_NAME', 'Chatify Messenger'),
```

## Storage Disk

The disk on which to store uploaded files and derived images by default. [More details](https://laravel.com/docs/filesystem)

```php
'storage_disk_name' => env('CHATIFY_STORAGE_DISK', 'public'),
```

## Routes' Configurations

This value is package's routes' configurations&#x20;

```php
'routes' => [
    'prefix' => env('CHATIFY_ROUTES_PREFIX', 'chatify'),
    'middleware' => env('CHATIFY_ROUTES_MIDDLEWARE', ['web','auth']),
    'namespace' => env('CHATIFY_ROUTES_NAMESPACE', 'Chatify\Http\Controllers'),
],
```

* `prefix` is the prefix of the routes in this package, so you can access the messenger from this value by going to `/chatify`.
* `middleware` is the middleware array applied on the routes of this package.
* `namespace` is the routes' controllers namespace.

### API Routes'

```php
'api_routes' => [
    'prefix' => env('CHATIFY_API_ROUTES_PREFIX', 'chatify'),
    'middleware' => env('CHATIFY_API_ROUTES_MIDDLEWARE', ['api']),
    'namespace' => env('CHATIFY_API_ROUTES_NAMESPACE', 'Chatify\Http\Controllers\Api'),
],
```

## Pusher configurations

From here you can change pusher's configurations,

```php
'pusher' => [
    'key' => env('PUSHER_APP_KEY'),
    'secret' => env('PUSHER_APP_SECRET'),
    'app_id' => env('PUSHER_APP_ID'),
    'options' => (array) [
        'cluster' => env('PUSHER_APP_CLUSTER'),
        'useTLS' => env('PUSHER_APP_USETLS'),
    ],
],
```

## User Avatar

This is user's avatar configurations

```php
'user_avatar' => [
    'folder' => 'users-avatar',
    'default' => 'avatar.png',
],
```

* `folder` is the default folder name located in the storage to store **users' avatars** in.
* `default` is the default user avatar image name, before uploading a new one.

## Gravatar

In this version (v1.4.x +) we add support for [Gravatar](https://Gravatar.com), so now you can use he default user avatar which is by default, or enable **Gravatar** to use it over the default

```php
'gravatar' => [
    'enabled' => true,
    'image_size' => 200,
    'imageset' => 'identicon'
],
```

* `enabled` set to `true` if you want to enable **Gravatar** over the default user avatar.
* `image_size` the size of user avatar generated from Gravatar.
* `imageset` Default imageset to use from the options bellow:
  * &#x20;`404`
  * `mp`
  * `identicon` (default)
  * `monsterid`
  * `wavatar`

## Attachments

This is attachments configurations

```php
'attachments' => [
    'folder' => 'attachments',
    'download_route_name' => 'attachments.download',
    'allowed_images' => (array) ['png','jpg','jpeg','gif'],
    'allowed_files' => (array) ['zip','rar','txt'],
    'max_upload_size' => 150, // MB
],
```

* `folder` is the default folder name located in the storage to store **attachments** in.
* `download_route_name` is name of the route to download the attachments.
* `allowed_images` is the default allowed images to be uploaded.
* `allowed_files` is the default allowed files to be uploaded.
* \`max\_upload\_size\` is the max file size allowed to be uploaded in the backend (e.g. message attachment, user avatar..).

## Messenger Colors

```php
/*
|-------------------------------------
| Messenger's colors
|-------------------------------------
*/
'colors' => (array) [
    '#2180f3',
    '#2196F3',
    '#00BCD4',
    '#3F51B5',
    '#673AB7',
    '#4CAF50',
    '#FFC107',
    '#FF9800',
    '#ff2522',
    '#9C27B0',
],
```

From the `colors` property you can set messenger's colors that users can change from the settings of their profile.

By default, there are **`10`** default colors as above.


# Customizations

You may want to do your own customizations and modifications on the code such as the `views` or the `controllers` to add a new feature for example ... etc. so, all you need is to publish the required `asset` mentioned below and start your own customizations!

## Package's assets

* `config`
* `views`
* `assets` (js, css, imgs)
* `models`
* `migrations`
* `controllers`

{% hint style="info" %}
The following assets already been published during the installation process:

`config`, `views`, `assets`, `models`, `migrations`

only the `controllers` asset is not published until you do.
{% endhint %}

### Publishing the assets

When you need to publish an asset, all you need is to run the following command :

```
php artisan vendor:publish --tag=chatify-<asset-name>
```

{% hint style="info" %}
Change`<asset-name>` with the required asset name (e.g. config) to be like `chatify-config`
{% endhint %}

### Controllers

You may want to do some modifications on the controllers of this package, so you need to follow the steps below:

1. Publish `controllers` asset

```
php artisan vendor:publish --tag=chatify-controllers
```

2\. Go to `config/chatify.php` and from `routes` properties, change `namespace` to `App\Http\Controllers\vendor\Chatify` to be like the following:

{% code title="config/chatify.php" %}

```php
...
'namespace' => env('CHATIFY_ROUTES_NAMESPACE', 'App\Http\Controllers\vendor\Chatify'),
```

{% endcode %}

same for `api_routes`, change the `namespace` to `App\Http\Controllers\vendor\Chatify\Api`&#x20;

{% code title="config/chatify.php" %}

```php
... 
'namespace' => env('CHATIFY_API_ROUTES_NAMESPACE', 'App\Http\Controllers\vendor\Chatify\Api').
```

{% endcode %}

3\. Go to `app/Http/Controllers/vendor/Chatify` and open `MessagesController.php` with your code editor .. then change the namespace to the same namespace specified in the step 2 above ..&#x20;

the same for `Api\MessagesController.php` .

Thats all you need to do.

Now, You can work with package's controller and start your modifications.

## Custom Chatify Class

When you want to override a method in `ChatifyMessenger.php` which is the main class of Chatify, then you have to follow the steps below:

* Create a class in your Laravel application (e.g. `CustomChatify.php`).
* inside your class, extend `Chatify/ChatifyMessenger`

```php
// CustomChatify.php

<?php

//...
use Chatify\ChatifyMessenger

class CustomChatify extends ChatifyMessenger{

    // Here, override the methods you want. 
    // For example:
    public function fetchMessage($id, $index = null)
    {
        //...
    }
}
```

* Use your custom class `CustomChatify` at `MessegesController.php` for both web and api controllers  if needed, instead of `Chatify`:

```php
// MessagesController.php
<?php
namespace App\Http\Controllers\vendor\Chatify;

//...
use Chatify\Facades\ChatifyMessenger as Chatify; // instead of this (remove it)
use Path\To\CustomChatify as Chatify; // use this (yours), use the right path/namespace to your custom class.
//...

class MessagesController extends Controller
{
//...
}
```

## Other Customizations

other customization such as

* Messenger name.
* Messenger colors.
* Messenger Max upload size.
* Messenger avatar.

&#x20;can be done by the [configurations](https://chatify.munafio.com/configurations) section.


# APIs

## APIs Postman Collection

Using [Postman](https://www.getpostman.com), open the application then click on `import` button .. then from the `Link` tab, paste the link below in:

<https://www.getpostman.com/collections/b910218741ea17d8e22b>


# Upgrading Chatify

When upgrading to a new version of Chatify, it's important that you carefully review [the upgrade guide](https://github.com/munafio/chatify/blob/master/UPGRADE.md).

In addition, when upgrading to any new Chatify version, you should re-publish Chatify's assets:

```
php artisan chatify:publish
```

To keep the assets **up-to-date** and avoid issues in future updates, you may add the `chatify:publish` command to the `post-update-cmd` scripts in your application's `composer.json` file:

{% code title="composer.json" %}

```javascript
{
    "scripts": {
        "post-update-cmd": [
            "@php artisan chatify:publish --ansi"
        ]
    }
}
```

{% endcode %}


# Notes

## Need a help?

I have created a server for **Chatify** on `Discord` to let you **up-to-date** and help you as much as I can ..&#x20;

so now you can chat with me, get a help, showcases, and most importantly to get announcements and updates about **Chatify**.&#x20;

So, [join now](https://discord.gg/RaxyKVykYJ) and keep updated.

## Groups feature

Soon will talk about this here.. check it back later.


# Introduction

<figure><img src="/files/idBRwO90hQ5lsr11UI2N" alt="Chatify preview image"><figcaption></figcaption></figure>

[![Latest Stable Version](https://camo.githubusercontent.com/c394e2627fe47531e92fbf044b16a89883059ece37d899e9eb3e639e68da7e35/68747470733a2f2f706f7365722e707567782e6f72672f6d756e6166696f2f636861746966792f762f737461626c65)](https://packagist.org/packages/munafio/chatify) [![Total Downloads](https://camo.githubusercontent.com/9489b37efdbbd5a54e322c2da29e09e1e71c01cf611608b98067f4199a988555/68747470733a2f2f706f7365722e707567782e6f72672f6d756e6166696f2f636861746966792f646f776e6c6f616473)](https://packagist.org/packages/munafio/chatify) [![License](https://camo.githubusercontent.com/d2d936519329b603c04e90d47bd438f952e104ce9230c53db2324ff5442fef02/68747470733a2f2f706f7365722e707567782e6f72672f6d756e6166696f2f636861746966792f6c6963656e7365)](https://packagist.org/packages/munafio/chatify)

[**Chatify**](https://github.com/munafio/chatify) is Laravel's #1 one-to-one chatting system package, helps you add a complete real-time chatting system to your new/existing Laravel application with only one command.

## Prerequisites

* PHP >=7.3.
* Laravel >=7.x
* Pusher Api Account or custom.

## Features

<figure><img src="/files/pHQQXz2IkF7qnlVDifoY" alt=""><figcaption></figcaption></figure>

* One-to-one users chat system.
* Real-time contact list updates.
* Favorite users system (Like stories style).
* Saved Messages to save your messages online like Telegram messenger app.
* Search functionality.
* Contact item's last message indicator (e.g. You: ....).
* Real-time user's active status.
* Real-time typing indicator.
* Real-time message seen indicator.
* Real-time internet connection status.
* Upload attachments (Photo/File).
* Send Emoji's.
* User details panel (Shared photos, delete conversation..).
* Responsive design with all devices.
* User settings and chat customization : user's profile photo, dark mode and chat color. with simple and wonderful UI design.

...and much more you have to discover it yourself.

## Demo

* Demo app - [Click Here](https://github.com/munafio/chatify-demo).

## Author

[Munaf A. Mahdi](https://www.munafio.com/p/contact-me.html)

### License

[MIT](https://choosealicense.com/licenses/mit/)


# Installation

{% embed url="<https://youtu.be/WTfDDy_-doA>" %}

OR

Follow the steps below :

## **1. Pusher Account and it's settings**

This package uses Pusher Api, so you need to :

* Create account and modify `.env` file of your Laravel app with your Pusher api credentials.
* This package uses Pusher's **client events**, and client events must be enabled for the application. You can do this in the `Settings` tab for your app within the Channels dashboard.\
  &#x20;[Read more about Pusher 'Triggering client events'](https://pusher.com/docs/channels/using_channels/events#triggering-client-events)

![](/files/-MaoTn4pQ_W2o0o_0P5C)

## **2. Require Chatify in your application**

**Quick Note:** If you are installing this package in a new project, make sure to install the default user authentication system provided with [Laravel](https://laravel.com/docs).

```bash
$ composer require munafio/chatify
```

## **3. Install Chatify**

All you need is to run the following command to setup everything for you:

```bash
$ php artisan chatify:install
```

This command will automatically do the following:

* Some configurations.
* Publishing the assets (config, views, assets, models, migrations)
* Storage symlink

## 4. Migration to database

```
$ php artisan migrate
```

## **5. App config (Only for Laravel <=v5.4)**

Only for applications that runs Laravel `<=v5.4` that doesn't support package **auto-discovery**, add the following provider into `config/app.php` providers array list :

{% code title="config/app.php" %}

```php
...
/*
* Package Service Providers...
*/
\Chatify\ChatifyServiceProvider::class,
...
```

{% endcode %}

and the following **alias** into into `config/app.php` **aliases**:

{% code title="config/app.php" %}

```php
...
/*
* Class Aliases
*/
'Chatify' => Chatify\Facades\ChatifyMessenger::class,
...
```

{% endcode %}

* After installing the package, you can access the messenger by the default path(routes prefix) which is `/chatify`, and you can change path name in the config file `config/chatify.php` as mentioned in the `configurations` below.

**That's it .. Enjoy :)**


# Configurations

You can find package's configuration file at `config/chatify.php` in your application, and will find the following properties that you can modify inside it:

## Display Name

This value is the name for the messenger displayed in the UI

```php
'name' => env('CHATIFY_NAME', 'Chatify Messenger'),
```

## Storage Disk

The disk on which to store uploaded files and derived images by default. [More details](https://laravel.com/docs/filesystem)

```php
'storage_disk_name' => env('CHATIFY_STORAGE_DISK', 'public'),
```

## Routes' Configurations

This value is package's routes' configurations&#x20;

```php
'routes' => [
    'prefix' => env('CHATIFY_ROUTES_PREFIX', 'chatify'),
    'middleware' => env('CHATIFY_ROUTES_MIDDLEWARE', ['web','auth']),
    'namespace' => env('CHATIFY_ROUTES_NAMESPACE', 'Chatify\Http\Controllers'),
],
```

* `prefix` is the prefix of the routes in this package, so you can access the messenger from this value by going to `/chatify`.
* `middleware` is the middleware array applied on the routes of this package.
* `namespace` is the routes' controllers namespace.

### API Routes'

```php
'api_routes' => [
    'custom' => env('CHATIFY_CUSTOM_ROUTES', false),
    'prefix' => env('CHATIFY_API_ROUTES_PREFIX', 'chatify'),
    'middleware' => env('CHATIFY_API_ROUTES_MIDDLEWARE', ['api']),
    'namespace' => env('CHATIFY_API_ROUTES_NAMESPACE', 'Chatify\Http\Controllers\Api'),
],
```

## Pusher configurations

From here you can change pusher's configurations,

```php
'pusher' => [
    'debug' => env('APP_DEBUG', false),
    'key' => env('PUSHER_APP_KEY'),
    'secret' => env('PUSHER_APP_SECRET'),
    'app_id' => env('PUSHER_APP_ID'),
    'options' => (array) [
        'cluster' => env('PUSHER_APP_CLUSTER'),
        'encrypted' => env('PUSHER_APP_USETLS'),
    ],
],
```

## User Avatar

This is user's avatar configurations

```php
'user_avatar' => [
    'folder' => 'users-avatar',
    'default' => 'avatar.png',
],
```

* `folder` is the default folder name located in the storage to store **users' avatars** in.
* `default` is the default user avatar image name, before uploading a new one.

## Gravatar

In this version (v1.4.x +) we add support for [Gravatar](https://Gravatar.com), so now you can use he default user avatar which is by default, or enable **Gravatar** to use it over the default

```php
'gravatar' => [
    'enabled' => true,
    'image_size' => 200,
    'imageset' => 'identicon'
],
```

* `enabled` set to `true` if you want to enable **Gravatar** over the default user avatar.
* `image_size` the size of user avatar generated from Gravatar.
* `imageset` Default imageset to use from the options bellow:
  * &#x20;`404`
  * `mp`
  * `identicon` (default)
  * `monsterid`
  * `wavatar`

## Attachments

This is attachments configurations

```php
'attachments' => [
    'folder' => 'attachments',
    'download_route_name' => 'attachments.download',
    'allowed_images' => (array) ['png','jpg','jpeg','gif'],
    'allowed_files' => (array) ['zip','rar','txt'],
    'max_upload_size' => 150, // MB
],
```

* `folder` is the default folder name located in the storage to store **attachments** in.
* `download_route_name` is name of the route to download the attachments.
* `allowed_images` is the default allowed images to be uploaded.
* `allowed_files` is the default allowed files to be uploaded.
* \`max\_upload\_size\` is the max file size allowed to be uploaded in the backend (e.g. message attachment, user avatar..).

## Messenger Colors

```php
/*
|-------------------------------------
| Messenger's colors
|-------------------------------------
*/
'colors' => (array) [
    '#2180f3',
    '#2196F3',
    '#00BCD4',
    '#3F51B5',
    '#673AB7',
    '#4CAF50',
    '#FFC107',
    '#FF9800',
    '#ff2522',
    '#9C27B0',
],
```

From the `colors` property you can set messenger's colors that users can change from the settings of their profile.

By default, there are **`10`** default colors as above.

## Notification sounds

```php
    /*
    |-------------------------------------
    | Sounds
    | You can enable/disable the sounds and
    | change sound's name/path placed at
    | `public/` directory of your app.
    |
    |-------------------------------------
    */
    'sounds' => [
        'enabled' => true,
        'public_path' => 'sounds/chatify',
        'new_message' => 'new-message-sound.mp3',
    ]

```

From the `sounds` property you can enable/disable notification sounds, change the public path where sounds located,  and change each sound file name if needed.


# Customizations

You may want to do your own customizations and modifications on the code such as the `views` or the `controllers` to add a new feature for example ... etc. so, all you need is to publish the required `asset` mentioned below and start your own customizations!

## Package's assets

* `config`
* `views`
* `assets` (js, css, imgs)
* `models`
* `migrations`
* `controllers`
* `routes`

{% hint style="info" %}
The following assets already been published during the installation process:

`config`, `views`, `assets`, `models`, `migrations`

only the `controllers` asset is not published until you do.
{% endhint %}

### Publishing the assets

When you need to publish an asset, all you need is to run the following command :

```
php artisan vendor:publish --tag=chatify-<asset-name>
```

{% hint style="info" %}
Change`<asset-name>` with the required asset name (e.g. config) to be like `chatify-config`
{% endhint %}

### Controllers

You may want to do some modifications on the controllers of this package, so you need to follow the steps below:

1. Publish `controllers` asset

```
php artisan vendor:publish --tag=chatify-controllers
```

2\. Go to `config/chatify.php` and from `routes` properties, change `namespace` to `App\Http\Controllers\vendor\Chatify` to be like the following:

{% code title="config/chatify.php" %}

```php
...
'namespace' => env('CHATIFY_ROUTES_NAMESPACE', 'App\Http\Controllers\vendor\Chatify'),
```

{% endcode %}

same for `api_routes`, change the `namespace` to `App\Http\Controllers\vendor\Chatify\Api`&#x20;

{% code title="config/chatify.php" %}

```php
... 
'namespace' => env('CHATIFY_API_ROUTES_NAMESPACE', 'App\Http\Controllers\vendor\Chatify\Api').
```

{% endcode %}

3\. Go to `app/Http/Controllers/vendor/Chatify` and open `MessagesController.php` with your code editor .. then change the namespace to the same namespace specified in the step 2 above ..&#x20;

the same for `Api\MessagesController.php` .

Thats all you need to do.

Now, You can work with package's controller and start your modifications.

## Custom Chatify Class

When you want to override a method in `ChatifyMessenger.php` which is the main class of Chatify, then you have to follow the steps below:

* Create a class in your Laravel application (e.g. `CustomChatify.php`).
* inside your class, extend `Chatify/ChatifyMessenger`

```php
// CustomChatify.php

<?php

//...
use Chatify\ChatifyMessenger

class CustomChatify extends ChatifyMessenger{

    // Here, override the methods you want. 
    // For example:
    public function fetchMessage($id, $index = null)
    {
        //...
    }
}
```

* Use your custom class `CustomChatify` at `MessegesController.php` for both web and api controllers  if needed, instead of `Chatify`:

```php
// MessagesController.php
<?php
namespace App\Http\Controllers\vendor\Chatify;

//...
use Chatify\Facades\ChatifyMessenger as Chatify; // instead of this (remove it)
use Path\To\CustomChatify as Chatify; // use this (yours), use the right path/namespace to your custom class.
//...

class MessagesController extends Controller
{
//...
}
```

## Custom Routes

You may want to do some modifications on the `routes` of this package, so you need to follow the steps below:

1. Publish `routes` asset

```
php artisan vendor:publish --tag=chatify-routes
```

2. go to the config file of the package in your app \`config/chatify.php\` the modify the following:

<pre class="language-php"><code class="lang-php">// config/chatify.php

<strong>...
</strong><strong>/*
</strong>|-------------------------------------
| Routes configurations
|-------------------------------------
*/
'routes' => [
    'custom' => env('CHATIFY_CUSTOM_ROUTES', false), // set to true
    ...
],
...

</code></pre>

## Other Customizations

other customization such as

* Messenger name.
* Messenger colors.
* Messenger Max upload size.
* Messenger avatar.

&#x20;can be done by the [configurations](https://chatify.munafio.com/configurations) section.


# Custom WebSocket Server

If you don't want to use Pusher as your WS server which is the default one, then you can follow one of the options bellow to configure your app and get it running with your custom server

## beyondcode/laravel-websockets

To replace `Pusher` with [`beyondcode/laravel-websockets`](https://beyondco.de/docs/laravel-websockets) you have to install & configure it with your app.. then modify your app's .env file as following:

{% code title="config/chatify.php" %}

```sh

PUSHER_APP_ID=pusher_app_id                           # Any random string
PUSHER_APP_KEY=pusher_app_key                         # Any random string
PUSHER_APP_SECRET=pusher_app_secret                   # Any random string
PUSHER_HOST=127.0.0.1                                 # Server host
PUSHER_PORT=6001                                      # Server port
PUSHER_SCHEME=http                                    # For SSL use `https`, otherwise use `http`.
PUSHER_APP_CLUSTER=mt1
LARAVEL_WEBSOCKETS_PORT="${PUSHER_PORT}"              # Laravel WS port

LARAVEL_WEBSOCKETS_SSL_LOCAL_PK=private_key_path      # Optional for using SSL.
LARAVEL_WEBSOCKETS_SSL_LOCAL_CERT=certificate_path    # Optional for using SSL.
```

{% endcode %}

then also you have to modify `laravel-websockets` config file to enable client events which is required to get it working well:

{% hint style="info" %}
You can make changes on this config file as your needs for other options available.
{% endhint %}

{% code title="config/websockets.php" %}

```
...
'apps' => [
        [
            ...
            'enable_client_messages' => true,         # Set to `true`
            ...
        ],
    ],
...
```

{% endcode %}

and make sure you're running the websockets server.

\
That's all you need 🚀.

{% hint style="warning" %}
if you change the env variables or any related config, then you may need to restart your websockets server.
{% endhint %}

## Laravel Reverb

First, you need to install Laravel Reverb. You can install it via composer by running the following command:

```bash
composer require laravel/reverb

php artisan reverb:install
```

After installing the package, you need to set the following environment variables in your \`.env\` file:

<pre><code><strong>REVERB_APP_ID       = your-app-id
</strong>REVERB_APP_KEY      = your-app-key
REVERB_APP_SECRET   = your-app-secret
REVERB_HOST         = your-host
REVERB_PORT         = your-port (default: 8080)
REVERB_SCHEME       = https (default: http for non-ssl)
</code></pre>

Then, Change the Pusher environment variables to Reverb environment variables:

```
PUSHER_APP_ID       = "${REVERB_APP_ID}"
PUSHER_APP_KEY      = "${REVERB_APP_KEY}"
PUSHER_APP_SECRET   = "${REVERB_APP_SECRET}"
PUSHER_HOST         = "${REVERB_HOST}"
PUSHER_PORT         = "${REVERB_PORT}"
PUSHER_SCHEME       = "${REVERB_SCHEME}"
PUSHER_APP_CLUSTER  = "mt1" (default: mt1)
BROADCAST_DRIVER    = reverb
```

That is it 🎉! You have successfully configured Laravel Reverb with Chatify.

#### Using SSL with Laravel Reverb

If you want to use SSL in your Reverb server, you need to follow the steps below:

1. update server configuration in `config/reverb.php` file. as shown below

```php
 'servers' => [
        'reverb' => [
            'host' => env('REVERB_SERVER_HOST', '0.0.0.0'),
            'port' => env('REVERB_SERVER_PORT', 8080),
            'hostname' => env('REVERB_HOST'),
            'options' => [
                'tls' => [
                    'verify_peer' => false,
                    'local_cert' => env('LARAVEL_WEBSOCKETS_SSL_LOCAL_CERT', null),
                    'local_pk' => env('LARAVEL_WEBSOCKETS_SSL_LOCAL_PK', null),
                ],
            ],
            'max_request_size' => env('REVERB_MAX_REQUEST_SIZE', 10_000),
            'scaling' => [
                'enabled' => env('REVERB_SCALING_ENABLED', false),
                'channel' => env('REVERB_SCALING_CHANNEL', 'reverb'),
                'server' => [
                    'url' => env('REDIS_URL'),
                    'host' => env('REDIS_HOST', '127.0.0.1'),
                    'port' => env('REDIS_PORT', '6379'),
                    'username' => env('REDIS_USERNAME'),
                    'password' => env('REDIS_PASSWORD'),
                    'database' => env('REDIS_DB', '0'),
                ],
            ],
            'pulse_ingest_interval' => env('REVERB_PULSE_INGEST_INTERVAL', 15),
            'telescope_ingest_interval' => env('REVERB_TELESCOPE_INGEST_INTERVAL', 15),
        ],

    ],

```

2. update the `REVERB_SERVER_HOST` and `REVERB_SERVER_PORT` in your `.env` file

```bash
LARAVEL_WEBSOCKETS_SSL_LOCAL_CERT  = <path-to-your-certificate-file>
LARAVEL_WEBSOCKETS_SSL_LOCAL_PK    = <path-to-your-public-key-file>
```

Thats all for SSL configuration.

## Other WS servers

For other WS servers you can follow same as the options above and what required by the custom server you're trying to use.


# APIs

## APIs Postman Collection

Using [Postman](https://www.getpostman.com), open the application then click on `import` button .. then from the `Link` tab, paste the link below in:

<https://www.getpostman.com/collections/b910218741ea17d8e22b>


# Upgrading Chatify

When upgrading to a new version of Chatify, it's important that you carefully review [the upgrade guide](https://github.com/munafio/chatify/blob/master/UPGRADE.md).

In addition, when upgrading to any new Chatify version, you should re-publish Chatify's assets:

```
php artisan chatify:publish
```

To keep the assets **up-to-date** and avoid issues in future updates, you may add the `chatify:publish` command to the `post-update-cmd` scripts in your application's `composer.json` file:

{% code title="composer.json" %}

```javascript
{
    "scripts": {
        "post-update-cmd": [
            "@php artisan chatify:publish --ansi"
        ]
    }
}
```

{% endcode %}


# Notes

## Need a help?

I have created a server for **Chatify** on `Discord` to let you **up-to-date** and help you as much as I can ..&#x20;

so now you can chat with me, get a help, showcases, and most importantly to get announcements and updates about **Chatify**.&#x20;

So, [join now](https://discord.gg/RaxyKVykYJ) and keep updated.

## Groups feature

Soon will talk about this here.. check it back later.


