PHPackages                             omnia/oalivechat - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. omnia/oalivechat

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

omnia/oalivechat
================

chat between admin and users

v0.3.3(2y ago)159MITJavaScript

Since Jul 18Pushed 2y ago1 watchersCompare

[ Source](https://github.com/OmniaAhmed208/chat-package)[ Packagist](https://packagist.org/packages/omnia/oalivechat)[ RSS](/packages/omnia-oalivechat/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (30)Used By (0)

chat-package
============

[](#chat-package)

[![Live chat Laravel Package](/art/preview.png)](/art/preview.png)

[![Total Downloads](https://camo.githubusercontent.com/49869772241d39c4b0a6af3ae5f60d629935c55ee0b5c78b7d9345a8d6dc60c7/68747470733a2f2f706f7365722e707567782e6f72672f6d756e6166696f2f636861746966792f646f776e6c6f6164733f7374796c653d666c61742d737175617265)](https://packagist.org/packages/omnia/oalivechat)[![License](https://camo.githubusercontent.com/e2da959dede71fc9afa3bdf46506b456a755aaa0786481110ab9cbefa2bf624b/68747470733a2f2f706f7365722e707567782e6f72672f6d756e6166696f2f636861746966792f6c6963656e73653f7374796c653d666c61742d737175617265)](https://packagist.org/packages/omnia/oalivechat)

Live Chat Laravel Package
-------------------------

[](#live-chat-laravel-package)

Laravel's one-to-one chatting system package between admin and user, helps you add a complete real-time chatting system to your new/existing Laravel application with some commands.

Features
--------

[](#features)

- chat system between admin and user.
- Real-time contact list updates.
- Upload attachments (Photo/File).
- Responsive design with all devices.
- Chat customization: chat color and font size. with a simple design.

...and much more you have to discover it yourself.

Demo
----

[](#demo)

- Demo app - [Click Here](https://github.com/OmniaAhmed208/live_chat_demo).

Documentation
-------------

[](#documentation)

### 1- Installation

[](#1--installation)

Run the following command to install the package:

```
composer require omnia/oalivechat
```

### 2- App Config

[](#2--app-config)

- In the `config/app.php` file, add the following line to the `providers` array:

```
"providers": {
  ...
  Omnia\Oalivechat\LiveChatServiceProvider::class,
}
```

### 3- publish Assets, css and js

[](#3--publish-assets-css-and-js)

- To publish the package's assets, CSS, and JS, run the following command:

```
php artisan vendor:publish --tag=public --force
```

This will create a `liveChat/tools` directory in the public directory.

- If you want to change the user chat color and position, you can do so in `public/liveChat/tools/chat/css/final.css`

### 4- Migration to database

[](#4--migration-to-database)

- make migration for your database

```
php artisan migrate
```

- make migration for package database

```
php artisan migrate --path=vendor/omnia/oalivechat/src/database/migrations
```

### 5- Middleware for authentication admin chat

[](#5--middleware-for-authentication-admin-chat)

- **First**, make sure to check the admin in the database and set its **role\_for\_messages** to `admin`, not 'user'.
- Create a middleware for checking the admin role:

```
php artisan make:middleware CheckAdminRole
```

- Add the following code to the handle method inside the middleware:

```
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
```

```
public function handle(Request $request, Closure $next)
{
  if (Auth::check()) {
    view()->share('loggedInUser', Auth::user());
    view()->share('adminRole', Auth::user()->role_for_messages === 'admin');
  }

  return $next($request);
}
```

- Then, add the middleware in `app/Http/Kernel.php`:

```
protected $middlewareGroups = [
  'web' => [
    // ...
    \App\Http\Middleware\CheckAdminRole::class,
  ],
];
```

- Create an AdminMessages middleware by this code:

```
php artisan make:middleware AdminMessages
```

- Add the following code to the handle method inside the middleware:

```
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
```

```
public function handle(Request $request, Closure $next)
{
  if (Auth::check() && Auth::user()->role_for_messages === 'admin') {
    return $next($request);
  }

  return redirect('/');
}
```

- add the middleware aliases in `app/Http/Kernel.php`:

```
protected $middlewareAliases = [
  // ...
  'adminMessages' => \App\Http\Middleware\AdminMessages::class,
  'adminRole' => \App\Http\Middleware\CheckAdminRole::class,
];
```

- Optionally, to show the `admin's status` in the user chat, make the following updates to the `LoginController`:
    if you want this step: you should have **laravel Authentication** to get loginController file.

```
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\Models\User;
```

```
public function authenticated(Request $request, $user)
{
    $user->status_for_messages = 'online';
    $user->save();
    return redirect()->intended($this->redirectPath());
}
public function logout(Request $request)
{
  $user = Auth::user();
  if ($user) {
      $userModel = User::find($user->id);
      $userModel->status_for_messages = 'offline';
      $userModel->save();
  }
  Auth::logout();
  // Additional logout logic...
  return redirect('/');
}
```

Note
----

[](#note)

- You must have a directory for the admin dashboard (any route) with the name `admin.index`.

Usage
-----

[](#usage)

- To import admin chat, create a link anywhere in your view, for example:

```
Messages
```

- if you want the counter of messages =&gt; put this code on your view and only enter your id name When calling the function which you want the count appeares inside it.

```

    window.onload = function() {
      var routeUrl = "{{ route('fetchNewMessages') }}";
      fetchNewMessages(routeUrl,'id_name');
    };

```

- For user chat, add the following code to a view that appears on all pages (e.g., footer):

```
@php
    $websiteName = "your website name";
    $websiteColor = "your color";
@endphp

@auth
  @if (Auth::user()->role_for_messages != 'admin')
      @include('liveChat::pages.main.chat', ['websiteName' => $websiteName], ['chatColor' => $websiteColor])
  @endif
@else
  @include('liveChat::pages.main.chat', ['websiteName' => $websiteName], ['chatColor' => $websiteColor])
@endauth
```

- if you have static design you may put `$websiteName` and `$websiteColor` any value or empty (e.g., "") but not remove them from the previous code.

Author
------

[](#author)

- [Omnia Ahmed](https://omnia-ahmed.onrender.com/index)

License
-------

[](#license)

Live chat is licensed under the \[MIT license\]

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

29

Last Release

965d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/92d738b9a9ac59fb391226fae6de0702b1be9b6e96eb5bfcf8f32f2a88fab380?d=identicon)[OmniaAhmed208](/maintainers/OmniaAhmed208)

---

Top Contributors

[![OmniaAhmed208](https://avatars.githubusercontent.com/u/93661363?v=4)](https://github.com/OmniaAhmed208 "OmniaAhmed208 (8 commits)")

### Embed Badge

![Health badge](/badges/omnia-oalivechat/health.svg)

```
[![Health](https://phpackages.com/badges/omnia-oalivechat/health.svg)](https://phpackages.com/packages/omnia-oalivechat)
```

###  Alternatives

[kylekatarnls/laravel-carbon-2

Carbon 2 adapter for Laravel

631.2M1](/packages/kylekatarnls-laravel-carbon-2)[symfony/ux-lazy-image

Lazy image loader and utilities for Symfony

36335.2k](/packages/symfony-ux-lazy-image)[nill/forum

yii2-integration-phpBB3.1

181.3k](/packages/nill-forum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
