PHPackages                             mtallalmansoor786/chat-package - 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. [Framework](/categories/framework)
4. /
5. mtallalmansoor786/chat-package

ActiveLibrary[Framework](/categories/framework)

mtallalmansoor786/chat-package
==============================

Peer-to-peer chat package for Laravel with Pusher support - Real-time messaging with chat rooms and vertical peer tables

v1.0.0(4mo ago)00MITBladePHP ^8.2

Since Dec 18Pushed 4mo agoCompare

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

READMEChangelogDependencies (3)Versions (2)Used By (0)

Chat Package for Laravel
========================

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

A peer-to-peer chat package for Laravel with real-time messaging using Pusher. This package provides a complete chat solution with chat rooms, peer management, and real-time message broadcasting.

Features
--------

[](#features)

- ✅ Peer-to-peer chat rooms
- ✅ Real-time messaging with Pusher
- ✅ Vertical peer table for each chat room
- ✅ Bootstrap 5 UI
- ✅ Auto-detects parent project's database connection
- ✅ Reads Pusher configuration from parent project's .env file
- ✅ Composer-based installation
- ✅ **SOLID Principles** - Follows all SOLID principles for maintainable code
- ✅ **Repository Pattern** - Clean separation of data access and business logic
- ✅ **Service Layer** - Business logic separated from controllers
- ✅ **Dependency Injection** - Interfaces and implementations properly bound

Installation
------------

[](#installation)

### Method 1: Composer Require (Recommended - After Publishing)

[](#method-1-composer-require-recommended---after-publishing)

Once published to Packagist or a Git repository:

```
composer require mtallalmansoor786/chat-package
```

Then:

1. Add Pusher credentials to `.env`
2. Run `php artisan migrate`
3. Access `/chat`

**That's it!** Works like any other Composer package.

### Method 2: Local Development (Current Project)

[](#method-2-local-development-current-project)

This package is already installed in the current project. See `INSTALLATION.md` for details.

### Method 3: Copy Package (Before Publishing)

[](#method-3-copy-package-before-publishing)

To use this package in a **different Laravel project** before publishing:

- **[QUICK\_START.md](QUICK_START.md)** - Fast 5-minute setup guide
- **[INSTALLATION\_OTHER\_PROJECTS.md](INSTALLATION_OTHER_PROJECTS.md)** - Detailed installation guide

---

Publishing to Composer
----------------------

[](#publishing-to-composer)

Want to make it installable via `composer require`? See:

- **[SETUP\_FOR\_COMPOSER.md](SETUP_FOR_COMPOSER.md)** - Quick 5-minute setup guide
- **[PUBLISH\_TO\_COMPOSER.md](PUBLISH_TO_COMPOSER.md)** - Complete publishing guide (Packagist, Private Repos, etc.)

**Quick Steps:**

1. Push package to GitHub
2. Submit to Packagist (or use private repo)
3. Install anywhere with: `composer require mtallalmansoor786/chat-package`

---

Installation (Existing Project)
-------------------------------

[](#installation-existing-project)

### Step 1: Install via Composer

[](#step-1-install-via-composer)

Add the package to your Laravel project's `composer.json`:

```
{
    "repositories": [
        {
            "type": "path",
            "url": "./packages/chat-package"
        }
    ],
    "require": {
        "mtallalmansoor786/chat-package": "*"
    }
}
```

Then run:

```
composer require mtallalmansoor786/chat-package
```

### Step 2: Configure Pusher

[](#step-2-configure-pusher)

Add your Pusher credentials to your `.env` file:

```
PUSHER_APP_ID=your_app_id
PUSHER_APP_KEY=your_app_key
PUSHER_APP_SECRET=your_app_secret
PUSHER_APP_CLUSTER=your_cluster
BROADCAST_DRIVER=pusher
```

### Step 3: Publish Configuration (Optional)

[](#step-3-publish-configuration-optional)

```
php artisan vendor:publish --tag=chat-package-config
```

### Step 4: Run Migrations

[](#step-4-run-migrations)

The package will automatically use your parent project's database connection. Run migrations:

```
php artisan migrate
```

### Step 5: Install Pusher PHP SDK (if not already installed)

[](#step-5-install-pusher-php-sdk-if-not-already-installed)

```
composer require pusher/pusher-php-server
```

Usage
-----

[](#usage)

### Access Chat Interface

[](#access-chat-interface)

Once installed, you can access the chat interface at:

```
/chat

```

### Create Chat Rooms

[](#create-chat-rooms)

Users can create chat rooms and add peers. Each chat room displays:

- Messages in real-time
- Vertical table of peers (users) in the room
- Online/offline status

### API Routes

[](#api-routes)

The package provides the following routes (all prefixed with `/chat`):

- `GET /chat` - Chat rooms list
- `GET /chat/room/{roomId}` - View specific chat room
- `POST /chat/room/create` - Create new chat room
- `POST /chat/room/{roomId}/message` - Send message
- `GET /chat/room/{roomId}/messages` - Get messages (API)
- `GET /chat/room/{roomId}/peers` - Get peers (API)

Configuration
-------------

[](#configuration)

The package automatically reads Pusher configuration from your parent project's `.env` file. No additional configuration is needed unless you want to customize:

```
// config/chat-package.php
return [
    'pusher' => [
        'app_id' => env('PUSHER_APP_ID'),
        'key' => env('PUSHER_APP_KEY'),
        'secret' => env('PUSHER_APP_SECRET'),
        'cluster' => env('PUSHER_APP_CLUSTER', 'mt1'),
        'useTLS' => true,
    ],
    'chat' => [
        'per_page' => 50,
        'max_message_length' => 1000,
    ],
];
```

Database Tables
---------------

[](#database-tables)

The package creates the following tables:

- `chat_rooms` - Stores chat room information
- `chat_room_user` - Pivot table for room members (peers)
- `messages` - Stores chat messages

All tables use your parent project's default database connection automatically.

Architecture
------------

[](#architecture)

This package follows **SOLID principles** and implements the **Repository Pattern**:

- **Single Responsibility**: Each class has one clear purpose
- **Open/Closed**: Open for extension, closed for modification
- **Liskov Substitution**: Interfaces can be swapped with implementations
- **Interface Segregation**: Focused, client-specific interfaces
- **Dependency Inversion**: Depend on abstractions, not concretions

### Code Structure

[](#code-structure)

```
src/
├── Http/
│   ├── Controllers/          # HTTP request handling
│   └── Requests/             # Form validation
├── Repositories/
│   ├── Contracts/             # Repository interfaces
│   └── [Repository].php       # Repository implementations
├── Services/
│   ├── Contracts/             # Service interfaces
│   └── ChatService.php       # Business logic
├── Models/                    # Eloquent models
└── Exceptions/               # Custom exceptions

```

See [SOLID\_PRINCIPLES.md](SOLID_PRINCIPLES.md) for detailed documentation.

Requirements
------------

[](#requirements)

- Laravel 12+
- PHP 8.2+
- Pusher account and credentials
- Bootstrap 5 (for UI)

License
-------

[](#license)

MIT

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance75

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

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

Unknown

Total

1

Last Release

142d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f5c851b619ea34125ab56a7a41cb52b4bc4d32aec016008b882f4d31e07b40e0?d=identicon)[Mtallalmansoor786](/maintainers/Mtallalmansoor786)

---

Top Contributors

[![tallalmansoor786](https://avatars.githubusercontent.com/u/191879942?v=4)](https://github.com/tallalmansoor786 "tallalmansoor786 (20 commits)")

---

Tags

laravelreal-timemessagingpusherchatpeer-to-peerchat-rooms

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mtallalmansoor786-chat-package/health.svg)

```
[![Health](https://phpackages.com/badges/mtallalmansoor786-chat-package/health.svg)](https://phpackages.com/packages/mtallalmansoor786-chat-package)
```

###  Alternatives

[laravel/reverb

Laravel Reverb provides a real-time WebSocket communication backend for Laravel applications.

1.5k9.4M48](/packages/laravel-reverb)[munafio/chatify

A package for Laravel PHP Framework to add a complete real-time chat system.

2.4k441.9k2](/packages/munafio-chatify)[lexxyungcarter/chatmessenger

Simple one-to-one/group chat messaging tool for Laravel 5, 6, 7, 8, 9 &amp; 10 with Pusher Integration

10724.1k](/packages/lexxyungcarter-chatmessenger)[syntaxlexx/chatmessenger

Simple one-to-one/group chat messaging tool for Laravel 5, 6, 7, 8, 9 &amp; 10 with Pusher Integration

10510.2k](/packages/syntaxlexx-chatmessenger)[baklysystems/laravel-chat-messenger

Laravel chat package

121.8k](/packages/baklysystems-laravel-chat-messenger)

PHPackages © 2026

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