GithubHelp home page GithubHelp logo

muhammed2024salama / chatmessage Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 2.0 228 KB

Chat Message API is a Laravel-based real-time messaging system using repositories, interfaces, services, and enums, with Pusher for instant updates. It follows an API-only architecture and includes ResponseHelper for standardized responses. ๐Ÿš€

PHP 50.56% JavaScript 0.70% CSS 0.03% Blade 48.72%
api-only chat-application enums laravel php pusher real-time repository-pattern-maker response-helper service-layer websockets

chatmessage's Introduction

Laravel Chat Application

Overview

This Laravel application manages chat messages between users using Laravel Echo, Pusher, and WebSockets for real-time updates.

Components

Event Broadcasting

The MessageSentEvent broadcasts new chat messages using private channels based on sender and receiver IDs.

Controllers

ChatMessageController

  • sendMessage: Handles sending messages between users.
  • getChatHistory: Retrieves chat history for a specific user.
  • markAsRead: Marks messages as read for a user.
  • contacts: Retrieves contacts for a user.
  • getAllChats: Retrieves all chat messages.

Resources

ChatMessageResource

  • Transforms ChatMessage model data into JSON responses, including sender and receiver information.

Requests

SendMessageRequest

  • Validates and handles requests to send messages, ensuring sender and receiver IDs are valid and different.

Interfaces

ChatMessageInterface

  • Defines methods for managing chat messages.

Repositories

ChatMessageRepository

  • Implements ChatMessageInterface methods using Eloquent models for database operations.

Services

ChatMessageService

  • Orchestrates message sending, broadcasting, and retrieval operations using the repository.

Frontend Integration

The frontend uses Laravel Echo and Pusher to listen for new messages and update the UI in real-time.

Setup

  1. Clone the repository.
  2. Install dependencies: composer install and npm install.
  3. Configure .env for database and Pusher settings.
  4. Run migrations: php artisan migrate.
  5. Compile frontend assets: npm run dev.

Usage

  1. Register/login users.
  2. Start sending messages between users.
  3. View chat history, mark messages as read, and manage contacts.

chatmessage's People

Contributors

muhammed2024salama avatar

Stargazers

Mohamed Azab avatar Hussein Ahmed avatar Salah EL-Din Wael avatar Noaman avatar Ahmed Osama avatar Ahmed Ouhssini avatar m.nour avatar Osama Sowidan avatar hossam elshahawy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.