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    
Last Updated Ratings Unique User Downloads Download Rankings
2021-09-25 (2 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 32 This week: 2All time: 10,337 This week: 108Up
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  
Name: Nyi Nyi Lwin <contact>
Classes: 8 packages by
Country: Myanmar Myanmar
Age: 29
All time rank: 30865 in Myanmar Myanmar
Week rank: 133 Up2 in Myanmar Myanmar Up
Innovation award
Innovation award
Nominee: 3x

Winner: 1x

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

  Files folder image Files  /  config  
File Role Description
  Plain text file laravel-chat.php Class Class source

  Files folder image Files  /  database  
File Role Description
Files folder imagemigrations (3 files)

  Files folder image Files  /  database  /  migrations  
File Role Description
  Plain text file 2017_06_23_044524_...ersations_table.php Class Class source
  Plain text file 2017_06_23_044539_...te_groups_table.php Class Class source
  Plain text file 2017_06_23_044546_...roup_user_table.php Class Class source

  Files folder image Files  /  resources  
File Role Description
Files folder imageassets (1 directory)

  Files folder image Files  /  resources  /  assets  
File Role Description
Files folder imagejs (1 directory)

  Files folder image Files  /  resources  /  assets  /  js  
File Role Description
Files folder imagecomponents (3 files)

  Files folder image Files  /  resources  /  assets  /  js  /  components  
File Role Description
  Accessible without login Plain text file CreateGroup.vue Data Auxiliary data
  Accessible without login Plain text file GroupChat.vue Data Auxiliary data
  Accessible without login Plain text file Groups.vue Data Auxiliary data

  Files folder image Files  /  routes  
File Role Description
  Accessible without login Plain text file channels.php Aux. Auxiliary script
  Accessible without login Plain text file web.php Aux. Auxiliary script

  Files folder image Files  /  src  
File Role Description
Files folder imageEvents (2 files)
Files folder imageHttp (1 directory)
Files folder imageModels (3 files)
  Plain text file LaravelChatServiceProvider.php Class Class source

  Files folder image Files  /  src  /  Events  
File Role Description
  Plain text file GroupCreated.php Class Class source
  Plain text file NewMessage.php Class Class source

  Files folder image Files  /  src  /  Http  
File Role Description
Files folder imageControllers (2 files)

  Files folder image Files  /  src  /  Http  /  Controllers  
File Role Description
  Plain text file ConversationController.php Class Class source
  Plain text file GroupController.php Class Class source

  Files folder image Files  /  src  /  Models  
File Role Description
  Plain text file Conversation.php Class Class source
  Plain text file Group.php Class Class source
  Plain text file UserGroup.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:32
This week:2
All time:10,337
This week:108Up
For more information send a message to info at phpclasses dot org.