juanrangel / laravel-converse
A real time chat package for laravel.
Requires
- php: ^7.3
- laravel/legacy-factories: ^1.1
- livewire/livewire: ^2.0
- pusher/pusher-php-server: ~3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- orchestra/canvas: ^5.0
- orchestra/testbench: ^5.0
- phpunit/phpunit: ^9.0
- psalm/plugin-laravel: ^1.2
- vimeo/psalm: ^4.0
README
This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.
Installation
You can install the package via composer:
composer require juanrangel/laravel-converse
Add the CanConverse trait to your user model
class User { use JuanRangel\Converse\Traits\CanConverse; }
You can publish and run the migrations with:
php artisan vendor:publish --provider="JuanRangel\Converse\ConverseServiceProvider" --tag="migrations" php artisan migrate
You can publish the config file with:
php artisan vendor:publish --provider="JuanRangel\Converse\ConverseServiceProvider" --tag="config"
This is the contents of the published config file:
return [
];
Realtime Messages
Add your pusher info in the.env file
PUSHER_APP_ID=12345
PUSHER_APP_KEY=12345
PUSHER_APP_SECRET=12345
PUSHER_APP_CLUSTER=us2
Set your broadcast driver to pusher in the .env file
BROADCAST_DRIVER=pusher
Enable the broadcast driver by uncommenting the App\Providers\BroadcastServiceProvider::class
in js/config/app.php
import Echo from 'laravel-echo'; window.Pusher = require('pusher-js'); window.Echo = new Echo({ broadcaster: 'pusher', key: process.env.MIX_PUSHER_APP_KEY, cluster: process.env.MIX_PUSHER_APP_CLUSTER, forceTLS: true });
Install laravel-echo and pusher https://laravel.com/docs/7.x/broadcasting
be sure and uncomment or add this to your bootstrap.js
file
npm install --save laravel-echo pusher-js
Now we can run the migration command
Run npm run dev
to compile the assets
php artisan migrate
Make sure that the BroadcastServiceProvider
is active in app.php
Usage
$laravel-converse = new JuanRangel\Converse(); echo $laravel-converse->echoPhrase('Hello, JuanRangel!');
We now have to install laravel-echo and pusher-js
npm install laravel-echo pusher-js
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email juan@vsellis.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.