ehsan-nosair/chativel

ChatiVel is a plugin that provides a real-time chat system for your laravel application, its support multi-guards, rtl, reverb-pusher, RESTapi, and much more.

v0.1.0-alpha.4 2025-01-05 07:38 UTC

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

real-time chat system for laravel & filament.

  • support multi gurad
  • support rtl
  • languages (en, ar)
  • using laravel broadcasting so you can use (reverb, pusher)

Important

the package is still in development stage

Installation

You can install the package via composer:

composer require ehsan-nosair/chativel

Run this command to install the package, it will publish config file and migrations

php artisan chativel:install

Following steps just if you want to add the chat page to filament panel

Run this command to copy assets to public folder

php artisan filament:assets

You need to use 'filament custom theme' create custom theme. Then add following line to your theme tailwind.config.js file.

content: [
    ...
    './vendor/ehsan-nosair/chativel/resources/views/**/**/*.blade.php',
    ...
]

this package use laravel broadcasting so you need to install it. use following command

php artisan install:broadcasting

then if you want to use it in a filament panel then you need to enable echo in config/filament like following for reverb

// ...
 
'echo' => [
    'broadcaster' => 'reverb',
    'key' => env('VITE_REVERB_APP_KEY'),
    'cluster' => env('VITE_REVERB_APP_CLUSTER'),
    'wsHost' => env('VITE_REVERB_HOST'),
    'wsPort' => env('VITE_REVERB_PORT'),
    'wssPort' => env('VITE_REVERB_PORT'),
    'authEndpoint' => '/broadcasting/auth',
    'disableStats' => true,
    'encrypted' => true,
    'forceTLS' => false,
],
 
// ...

then start reverb server:

php artisan reverb:start

Usage

First: you need to use Chatable trait in your models

<?php

use EhsanNosair\Chativel\Traits\Chatable;

class User extends Authenticatable
{
    use Chatable;
}

Note

you can customize model searchable columns & display column by overriting searchableColumns() & getDisplayColumnAttribute() methods

Second: you need to add your chatable models to chatables array in config/chativel

    <?php
    // ...
    'chatables' => [
        \App\Models\User::class,
    ],
    // ...

Final step: use plusing in your filament panel provider

<?php

use EhsanNosair\Chativel\ChativelPlugin;

class AdminPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            //...
            ->plugins([
                ChativelPlugin::make()
            ]);
    }
}

## Testing

```bash
composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.