PHP Classes

Laravel Group Chat: Interactive chat module for multiple users

Recommend this page to a friend!
  Info   View files Documentation   View files View files (20)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 45 All time: 10,528 This week: 171Up
Version License PHP version Categories
laravel-chat 1.0.0The PHP License5PHP 5, Libraries, Chat
Description 

Author

This package implements a interactive chat module for multiple users.

It provides a Web based chat system based on the Laravel application that allows conversations between groups of users.

The package provides models, views and controller classes that can manage conversations and groups of users that participate in those conversations.

Picture of Nyi Nyi Lwin
  Performance   Level  
Innovation award
Innovation award
Nominee: 6x

Winner: 3x

 

Details

Laravel Chat [ WIP ]

Simple Laravel Group Chat Module

Latest Stable Version Total Downloads

Installation

Install using composer:

 composer require php-junior/laravel-chat

Once installed, in your project's config/app.php file replace the following entry from the providers array:

 PhpJunior\LaravelChat\LaravelChatServiceProvider::class,

And

 php artisan vendor:publish --provider="PhpJunior\LaravelChat\LaravelChatServiceProvider"
 php artisan queue:table
 php artisan queue:failed-table
 php artisan migrate

Uncomment App\Providers\BroadcastServiceProvider in the providers array of your config/app.php configuration file

Configuration

 BROADCAST_DRIVER=pusher
 PUSHER_APP_ID=your-pusher-app-id
 PUSHER_APP_KEY=your-pusher-app-key
 PUSHER_APP_SECRET=your-pusher-app-secret
 PUSHER_APP_CLUSTER=your-pusher-app-cluster

Add the PhpJunior\LaravelChat\Models\UserGroup trait to your User model

Install the JavaScript dependencies:

 npm install
 npm install --save laravel-echo pusher-js vue-timeago

At the bottom of resources/assets/js/bootstrap.js file:

 import Echo from "laravel-echo"
 window.Pusher = require('pusher-js');
 
 window.Echo = new Echo({
     broadcaster: 'pusher',
     key: 'your-pusher-app-key',
     cluster: 'your-pusher-app-cluster',
     encrypted: true
 });

In resources/assets/js/app.js file:

 import VueTimeago from 'vue-timeago';
 window.Bus = new Vue();
 
 Vue.component('groups', require('./components/laravel-chat/Groups.vue'));
 Vue.component('create-group', require('./components/laravel-chat/CreateGroup.vue'));
 Vue.component('group-chat', require('./components/laravel-chat/GroupChat.vue'));
 
 Vue.use(VueTimeago, {
     name: 'timeago', // component name, `timeago` by default
     locale: 'en-US',
     locales: {
         // you will need json-loader in webpack 1
         'en-US': require('vue-timeago/locales/en-US.json')
     }
 })

Run npm run dev to recompile your assets.

Usage

 $groups = auth()->user()->groups;
 $users = User::where('id', '<>', auth()->user()->id)->get();
 $user = auth()->user();
 return view('home', [ 'groups' => $groups , 'users' => $users , 'user' => $user ]); 

In your templates

 <create-group :initial-users="{{ $users }}" :current-user="{{ $user }}"></create-group>
 <groups :initial-groups="{{ $groups }}" :user="{{ $user }}"></groups>

License

The MIT License (MIT). Please see License File for more information.

Do not forget to run the queue listener to broadcast the events

  Files folder image Files  
File Role Description
Files folder imageconfig (1 file)
Files folder imagedatabase (1 directory)
Files folder imageresources (1 directory)
Files folder imageroutes (2 files)
Files folder imagesrc (1 file, 3 directories)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
 100%
Total:45
This week:0
All time:10,528
This week:171Up