xparthxvorax / larachat
A real-time socket based chat application for Laravel
Installs: 34
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 0
pkg:composer/xparthxvorax/larachat
Requires
- php: >=7.0
- predis/predis: 1.1
This package is auto-updated.
Last update: 2025-10-22 04:08:45 UTC
README
Prerequisites:
You must have PHP > 7.0, Laravel > 5.0, Web server (Apache/Ngnix), Node.js and npm installed on your machinePlease follow below steps to install the package to a new or an existing Laravel site:
-
Run
php artisan make:authto scaffold basic login and registration views and routes -
Install package using
composer require xparthxvorax/larachatcommand -
Run
php artisan larachat:installcommand -
Setup front-end:
- Run
npm install -g laravel-echo-servercommand - Add below dependencies to the
package.jsonfile:
"dependencies": { "laravel-echo": "^1.4.1", "socket.io-client": "^2.1.1" }- Run
npm installcommand - Add below lines to
resources/js/bootstrap.js
import Echo from "laravel-echo" window.io = require('socket.io-client'); window.Echo = new Echo({ broadcaster: 'socket.io', host: window.location.hostname + ':6001' });- Add below line to
resources/js/app.js
Vue.component('larachat-component', require('./components/LarachatComponent.vue'));- To display a user list, add
<larachat-component></larachat-component>inresources/views/home.blade.phplike:
<div class="container"> <div class="row justify-content-center"> <div class="col-md-8"> <div class="card"> <div class="card-header">Dashboard</div> <div class="card-body"> @if (session('status')) <div class="alert alert-success" role="alert"> {{ session('status') }} </div> @endif You are logged in! </div> <larachat-component></larachat-component> </div> </div> </div> </div>Or you may put
<larachat-component></larachat-component>to any other view wherever it fits best as per your site design layout. Also you may modify Vue component's default HTML and CSS intoresources\js\components\LarachatComponent.vueas per your requirement. - Run
-
Set
BROADCAST_DRIVER=redisand addLARAVEL_ECHO_SERVER_AUTH_HOST=your-site-url -
Runn
npm run devcommand to compile front-end assets -
Run
laravel-echo-server startto start socket server. Keep the command running or you may use supervisor for that(https://laravel.com/docs/master/queues#supervisor-configuration)
Demo video: https://www.youtube.com/watch?v=GKeMBxQWOyw
Live demo site: http://52.66.210.249/larachat/public/
-
Account 1:
Username: kylie71@example.org
Password: secret
-
Account 2:
Username: pfannerstill.eloise@example.org
Password: secret
-
Account 3:
Username: tremaine.kiehn@example.com
Password: secret