sunarctech/laravel-chat

Pre-build Laravel chat package.

1.2 2022-03-15 12:17 UTC

This package is auto-updated.

Last update: 2024-04-21 10:20:09 UTC


README

image

Laravel Chat System 💯

Pre-build Laravel chat package. You can use this package to create a chat/messaging Laravel application or you can use the pre-build front-end part to kick-start your project.

Packagist License For PHP Scrutinizer Code Quality Github Issues Github Stars Github Forks Packagist Packagist Release Packagist Downloads

Pre-build Laravel chat package. You can use this package to create a chat/messaging Laravel application or you can use the pre-build front-end part to kick-start your project.

Installation

Via Composer

composer require sunarctech/laravel-chat

then

php artisan chat:install

Instructions

Install this package and add authentication gurad, you can use some package like Laravel UI

This package uses WebSockets and for that dependent on beyondcode/laravel-websockets

Publish Files

php artisan vendor:publish --provider="BeyondCode\LaravelWebSockets\WebSocketsServiceProvider" --tag="config" --tag="migrations"

Configurations

Make necessary change in order to change file validations.

chat.php

return [
    'image_validation' => "max:1024|mimes:png,jpeg",
    'video_validation' => "max:102400|mimes:mp4",
    'file_validation' => "max:1024|mimes:txt",
];

Make necessary change in order to activate the websocket.

websockets.php

'enable_client_messages' => 'true',

broadcasting.php

'pusher' => [
    'driver' => 'pusher',
    'key' => env('PUSHER_APP_KEY'),
    'secret' => env('PUSHER_APP_SECRET'),
    'app_id' => env('PUSHER_APP_ID'),
    'options' => [
        'cluster' => env('PUSHER_APP_CLUSTER'),
        'useTLS' => true,
        'host' => '127.0.0.1',
        'port' => 6001,
        'scheme' => 'http',
    ],
],

Uncomment this provider from app.php, If not present please add this.

/*
* Application Service Providers...
*/
...
App\Providers\BroadcastServiceProvider::class,
...

.env

BROADCAST_DRIVER=pusher
PUSHER_APP_ID=myappid
PUSHER_APP_KEY=myappkey
PUSHER_APP_SECRET=myappsecret

Database

Package ships with some migration files, which is required in order to save the messages, defaul driver is used MySQL.

Migrate

php artisan migrate

Link Storage

php artisan storage:link

How to use?

In order to use the chat, Fisrt need to start the websocket server Using Command:

php artisan websocket:serve

Visit the route, registered with Package.

www.yourdomain.com/chat

Known Error

You might face dependency version mismatch issue at the time of installation, To fix the issue just add -W:

composer require sunarctech/laravel-chat -W

Created by SunArc Technologies

We are the leading Software Development Company providing end-to-end IT services & solutions to our esteemed customers in multiple industries and domains for the past 18+ years? Give us a call.

https://sunarctechnologies.com/
info@sunarctechnologies.com
+91-8764025209

🔧 Supported Versions

Versions supported.

Version Laravel Version PHP Version Support
0.1 <=7.0 7.3 - 8.x All features

License

The MIT Public License. Please see LICENSE for more information.