PHPackages                             ashfaq1701/laravel-chat - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ashfaq1701/laravel-chat

ActivePackage[Utility &amp; Helpers](/categories/utility)

ashfaq1701/laravel-chat
=======================

A Basic channel based chat implementation for laravel 5.2 or less

1.0.0(9y ago)1492MITCSS

Since Sep 26Pushed 9y ago1 watchersCompare

[ Source](https://github.com/ashfaq1701/laravel-chat)[ Packagist](https://packagist.org/packages/ashfaq1701/laravel-chat)[ RSS](/packages/ashfaq1701-laravel-chat/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

Laravel Chat
============

[](#laravel-chat)

This package is a simple but feature rich implementation of chatting functionality using [Ratchet](https://github.com/ratchetphp/Ratchet) based Laravel pacakage [Laravel Socket](https://github.com/codemash/laravel-socket). It is a channel based chatting platform which has base for group chatting, file and image messaging with image display on client side. Also it has push notification for user online and offline status. Has limited message loading and load more option. At once even with required modification of css, it can be deployed as a chat application at once. It has easy installation procedure and published resources to adapt to any use cases.

Requirements
------------

[](#requirements)

Laravel 5.2. 5.3 support coming soon.

Installation
------------

[](#installation)

You can install the package using the [Composer](https://getcomposer.org/) package manager. You can install it by running this command in your project root:

```
composer require ashfaq1701/laravel-chat
```

Add the `Codemash\Socket\SocketServiceProvider` and `Ashfaq1701\LaravelChat\Providers\LaravelChatServiceProvider` provider to the `providers` array in `config/app.php`':

```
'providers' => [
    ...
    Codemash\Socket\SocketServiceProvider::class,
    Ashfaq1701\LaravelChat\Providers\LaravelChatServiceProvider::class,
],
```

Then run the following command,

```
php artisan vendor:publish
```

The published assets can be found at `config/socket.php`, `config/chat.php`, `app/Http/Controllers/Chat`, `app/Repositories`, `app/Listeners`, `app/Models`, `database/migrations`, `database/seeds`, `resources/views/chat`, css and javascripts at `public/vendor/socket` and `public/vendor/chat` directories. Routes will be published too. It is important to know that the `Chat::javascript()` facade function will include both a default socket located at `window.appSocket` and `socket.js`, `ajax-fileupload.js` and `chat.js` source file located in the vendor folder. These are merely a start, and provide a quick way to work with the chats and sockets but you are always free to write a custom implementation.

After publish you have to follow some steps again.

Add `App\Providers\ChatEventServiceProvider` to the `providers` array in `config/app.php`.

```
'providers' => [
    ...
    App\Providers\ChatEventServiceProvider::class,
],
```

Then, add the facades to your `aliases` array. The default facade provides an easy-to-use interface to integrate the socket files in your view.

```
'aliases' => [
    ...
    'Socket' => Codemash\Socket\Facades\Socket::class,
    'Chat' => Ashfaq1701\LaravelChat\Facades\Chat::class,
]
```

Then run migrations,

```
php artisan migrate
```

There are few helping seeds provided for you to get you started. To run them add then in the run method of `DatabaseSeeder` class. You could need composer dump-autoload command once for the publish to be effected for seeders.

```
public function run()
{
    $this->call(UserTableSeeder::class);
    $this->call(ChannelsUsersTableSeeder::class);
}
```

Then run those seeders,

```
php artisan db:seed
```

Use the `Ashfaq1701\LaravelChat\Traits\Chattable` trait from the `App\User` model.

```
...
use Ashfaq1701\LaravelChat\Traits\Chattable;

class User extends Authenticatable
{
	use Chattable;
	...
```

Then inside `App\Http\Middleware\VerifyCsrfToken.php` exclude the ajax file upload route from the CSRF protection. This is required otherwise the file and image messages will not work. Also inside `public\`, create `uploads\files` empty directory.

```
class VerifyCsrfToken extends BaseVerifier
{
    /**
     * The URIs that should be excluded from CSRF verification.
     *
     * @var array
     */
    protected $except = [
    	'/uploads/file'
    ];
}
```

The last thing is add a section in the `resources\views\layouts\app.blade.php`. At the end of all javascript declarations, add a section named `custom-scripts`. Like this,

```
	...
	@yield('content')

    {{--  --}}
    @yield('custom-scripts')

```

Getting started
---------------

[](#getting-started)

Finally, let's run the socket listener. You can do this by running the following artisan command in the project root:

```
php artisan socket:listen
```

After that run the application (for dev).

```
php artisan serve
```

Check database for a set of email and password (preferably first user if the seeder ran). Then login to the system and visit `http://localhost:8000/chat` url. You will see a fully functional chat running. Experiment with it. All files are published, so you can do almost any customization you need.

Production
----------

[](#production)

Ubuntu provides the neat `nohup` tool, which runs processes on the background. In case you'd like to run your socket on a production server and you're on Ubuntu, you may always use the nohup tool to run the socket listener.

```
nohup php artisan socket:listen &
```

When using the `jobs` command, you'll see the socket running. It's easy to kill the process using the `kill ` command. The process ID is listed in the jobs list.

Contributing
------------

[](#contributing)

If you're having problems, spot a bug, or have a feature suggestion, please log and issue on Github. If you'd like to have a crack yourself, fork the package and make a pull request. Any improvements are more than welcome.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity63

Established project with proven stability

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3564d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ca630b21f01ee473212d09a13575950e020864ac093a5a6a92fc0c64fdbf4084?d=identicon)[Md Ashfaq Salehin](/maintainers/Md%20Ashfaq%20Salehin)

### Embed Badge

![Health badge](/badges/ashfaq1701-laravel-chat/health.svg)

```
[![Health](https://phpackages.com/badges/ashfaq1701-laravel-chat/health.svg)](https://phpackages.com/packages/ashfaq1701-laravel-chat)
```

###  Alternatives

[digilist/snakedumper

5045.9k](/packages/digilist-snakedumper)[cinghie/yii2-traits

Yii2 Traits

116.9k8](/packages/cinghie-yii2-traits)[emanueleminotto/faker-service-provider

Faker Service Provider for Silex

162.9k](/packages/emanueleminotto-faker-service-provider)[flowpack/nodegenerator

Random nodes generator for Neos CMS

122.1k](/packages/flowpack-nodegenerator)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
