PHPackages                             omarelnaghy/laravel-chat-soul - 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. omarelnaghy/laravel-chat-soul

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

omarelnaghy/laravel-chat-soul
=============================

A comprehensive real-time chat system package for Laravel 11 applications

v1.0.4(7mo ago)13MITPHPPHP ^8.1

Since Sep 15Pushed 7mo agoCompare

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

READMEChangelog (2)Dependencies (5)Versions (6)Used By (0)

Laravel Chat Soul
=================

[](#laravel-chat-soul)

A comprehensive, production-ready real-time chat system package for Laravel 11 applications. Laravel Chat Soul provides modular chat functionality with broadcasting, presence tracking, typing indicators, file attachments, and extensive customization options.

Features
--------

[](#features)

### Core Functionality

[](#core-functionality)

- **One-to-one and Group Conversations** - Support for both direct messages and group chats
- **Message Management** - Send, edit, delete messages with text content and file attachments
- **Read Receipts** - Track which users have read specific messages with timestamps
- **Real-time Typing Indicators** - Show when users are typing in conversations
- **Online Presence System** - Track and display active users
- **Message History** - Paginated message loading with search capabilities
- **File Attachments** - Support for images, documents, and other file types

### Real-time Features

[](#real-time-features)

- **Laravel Echo Compatible** - Full integration with Laravel's broadcasting system
- **Multiple Driver Support** - Pusher, Ably, Laravel WebSockets, Redis
- **Custom Events** - MessageSent, UserTyping, UserOnline, UserOffline, MessageRead
- **Automatic Channel Authorization** - Private conversation channels with user verification

### API &amp; Architecture

[](#api--architecture)

- **RESTful API** - Clean, consistent API endpoints under `/api/chat/*`
- **Laravel Sanctum Authentication** - Secure API authentication (configurable)
- **JSON API Resources** - Standardized response formatting
- **Rate Limiting** - Built-in protection against abuse
- **Comprehensive Validation** - Request validation for all endpoints

### Customization

[](#customization)

- **Extensive Configuration** - Every aspect configurable via `chat-soul.php`
- **Database Flexibility** - Custom table prefixes and connections
- **Feature Flags** - Enable/disable specific functionality
- **Multi-guard Authentication** - Support for different authentication systems

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

[](#installation)

### Requirements

[](#requirements)

- PHP 8.1+
- Laravel 11.0+
- Laravel Sanctum 4.0+

### Install Package

[](#install-package)

```
composer require omarelnaghy/laravel-chat-soul
```

### Publish Configuration and Migrations

[](#publish-configuration-and-migrations)

```
# Publish configuration file
php artisan vendor:publish --tag=chat-soul-config

# Publish migrations
php artisan vendor:publish --tag=chat-soul-migrations

# Publish frontend components (optional)
php artisan vendor:publish --tag=chat-soul-frontend

# Run migrations
php artisan migrate
```

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

[](#configuration)

The package includes a comprehensive configuration file at `config/chat-soul.php`:

```
return [
    // Database configuration
    'database' => [
        'prefix' => 'chat_',
        'connection' => env('CHAT_SOUL_DB_CONNECTION', config('database.default')),
    ],

    // Authentication settings
    'auth' => [
        'guard' => env('CHAT_SOUL_GUARD', 'sanctum'),
        'user_model' => env('CHAT_SOUL_USER_MODEL', 'App\\Models\\User'),
    ],

    // Broadcasting configuration
    'broadcasting' => [
        'driver' => env('CHAT_SOUL_BROADCAST_DRIVER', 'pusher'),
        'channel_prefix' => env('CHAT_SOUL_CHANNEL_PREFIX', 'chat-soul'),
    ],

    // Feature flags
    'features' => [
        'typing_indicators' => env('CHAT_SOUL_TYPING_INDICATORS', true),
        'read_receipts' => env('CHAT_SOUL_READ_RECEIPTS', true),
        'presence' => env('CHAT_SOUL_PRESENCE', true),
        'file_uploads' => env('CHAT_SOUL_FILE_UPLOADS', true),
    ],

    // ... more configuration options
];
```

User Model Setup
----------------

[](#user-model-setup)

Add the `HasChatSoul` trait to your User model:

```
