# 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)

![](https://3440785526-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MadTKZsUULReRLoW6yX%2F-MaoPI3L1SQuwgUMgAA7%2F-MaoTn4pQ_W2o0o_0P5C%2FScreen%20Shot%202021-05-28%20at%2010.28.42%20PM.png?alt=media\&token=67ff2c94-5af3-42a1-9b32-5dac72bef507)

## **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 :)**
