Download the PHP package mtallalmansoor786/chat-package without Composer
On this page you can find all versions of the php package mtallalmansoor786/chat-package. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mtallalmansoor786/chat-package
More information about mtallalmansoor786/chat-package
Files in mtallalmansoor786/chat-package
Package chat-package
Short Description Peer-to-peer chat package for Laravel with Pusher support - Real-time messaging with chat rooms and vertical peer tables
License MIT
Informations about the package chat-package
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
- ✅ 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
Method 1: Composer Require (Recommended - After Publishing)
Once published to Packagist or a Git repository:
Then:
- Add Pusher credentials to
.env - Run
php artisan migrate - Access
/chat
That's it! Works like any other Composer package.
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)
To use this package in a different Laravel project before publishing:
- QUICK_START.md - Fast 5-minute setup guide
- INSTALLATION_OTHER_PROJECTS.md - Detailed installation guide
Publishing to Composer
Want to make it installable via composer require? See:
- SETUP_FOR_COMPOSER.md - Quick 5-minute setup guide
- PUBLISH_TO_COMPOSER.md - Complete publishing guide (Packagist, Private Repos, etc.)
Quick Steps:
- Push package to GitHub
- Submit to Packagist (or use private repo)
- Install anywhere with:
composer require mtallalmansoor786/chat-package
Installation (Existing Project)
Step 1: Install via Composer
Add the package to your Laravel project's composer.json:
Then run:
Step 2: Configure Pusher
Add your Pusher credentials to your .env file:
Step 3: Publish Configuration (Optional)
Step 4: Run Migrations
The package will automatically use your parent project's database connection. Run migrations:
Step 5: Install Pusher PHP SDK (if not already installed)
Usage
Access Chat Interface
Once installed, you can access the chat interface at:
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
The package provides the following routes (all prefixed with /chat):
GET /chat- Chat rooms listGET /chat/room/{roomId}- View specific chat roomPOST /chat/room/create- Create new chat roomPOST /chat/room/{roomId}/message- Send messageGET /chat/room/{roomId}/messages- Get messages (API)GET /chat/room/{roomId}/peers- Get peers (API)
Configuration
The package automatically reads Pusher configuration from your parent project's .env file. No additional configuration is needed unless you want to customize:
Database Tables
The package creates the following tables:
chat_rooms- Stores chat room informationchat_room_user- Pivot table for room members (peers)messages- Stores chat messages
All tables use your parent project's default database connection automatically.
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
See SOLID_PRINCIPLES.md for detailed documentation.
Requirements
- Laravel 12+
- PHP 8.2+
- Pusher account and credentials
- Bootstrap 5 (for UI)
License
MIT