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