PHP Classes

Laravel Group Chat: Interactive chat module for multiple users

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 48 All time: 10,739 This week: 455Up
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: 12 packages by
Country: Myanmar Myanmar
Age: 32
All time rank: 26565 in Myanmar Myanmar
Week rank: 46 Up1 in Myanmar Myanmar Up
Innovation award
Innovation award
Nominee: 7x

Winner: 4x

Documentation

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 (20)  
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 (20)  /  config  
File Role Description
  Plain text file laravel-chat.php Class Class source

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

  Files folder image Files (20)  /  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 (20)  /  resources  
File Role Description
Files folder imageassets (1 directory)

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

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

  Files folder image Files (20)  /  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 (20)  /  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 (20)  /  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 (20)  /  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 (20)  /  src  /  Http  
File Role Description
Files folder imageControllers (2 files)

  Files folder image Files (20)  /  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 (20)  /  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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:48
This week:0
All time:10,739
This week:455Up