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

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

ronasit/laravel-chat
====================

This package implements chat functionality based on push notifications.

0.3.3(1mo ago)11.4k↑170.6%1[3 issues](https://github.com/RonasIT/laravel-chat/issues)[3 PRs](https://github.com/RonasIT/laravel-chat/pulls)MITPHPPHP ^8.3CI passing

Since Aug 29Pushed 1w ago4 watchersCompare

[ Source](https://github.com/RonasIT/laravel-chat)[ Packagist](https://packagist.org/packages/ronasit/laravel-chat)[ RSS](/packages/ronasit-laravel-chat/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (29)Versions (39)Used By (0)

Laravel Chat Plugin
===================

[](#laravel-chat-plugin)

[![Coverage Status](https://camo.githubusercontent.com/9123287556537e887224209e4c74278a0f985caae82d4973708558d444300860/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f526f6e617349542f6c61726176656c2d636861742f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/RonasIT/laravel-chat?branch=master)

Table of Contents
-----------------

[](#table-of-contents)

- [Introduction](#introduction)
- [Installation](#installation)
- [Integration with LaravelSwagger](#integration-with-laravelswagger)
- [API Endpoints](#api-endpoints)
    - [Conversations](#conversations)
    - [Messages](#messages)
- [Broadcast Events](#broadcast-events)
    - [Channel Authorization](#channel-authorization)
    - [Events](#events)
- [Contributing](#contributing)
- [License](#license)

Introduction
------------

[](#introduction)

This plugin adds the ability for users to work with chat functionalities in a Laravel application.

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

[](#installation)

1. Install the package using the following command:

```
composer require ronasit/laravel-chat
```

2. Publish the package configuration:

```
php artisan vendor:publish --provider=RonasIT\\Chat\\ChatServiceProvider
```

3. If you use non default `App\Models\User` model - update `chat.classes.user_model` config.

Integration with [LaravelSwagger](https://github.com/RonasIT/laravel-swagger)
-----------------------------------------------------------------------------

[](#integration-with-laravelswagger)

This package includes an OpenAPI documentation file. To include it in your project's documentation, you need to register it in the `auto-doc.additional_paths` config:

`vendor/ronasit/laravel-chat/documentation.json`

API Endpoints
-------------

[](#api-endpoints)

All routes are registered by default, you can change the route registration by calling `Route::chat()` in your routes file (e.g. `routes/api.php`).

- feel free to call `Route::chat()` helper inside any route wrappers like `group`, `prefix`, etc. to wrap package routes; **In this case default package's routes start to return 404.**
- calling `Route::chat()` without args will add all package routes inside the calling helper place;
- calling `Route::chat()` with `ChatRouteActionEnum` cases as arguments will register **only** the specified routes — all others are automatically disabled:

```
// routes/api.php
use RonasIT\Chat\Enums\ChatRouteActionEnum;

Route::prefix('api')->group(function () {
    Route::middleware('auth_group')->group(function () {
        Route::chat(
            ChatRouteActionEnum::ConversationsSearch,
            ChatRouteActionEnum::MessageCreate,
        );
    });
});
```

All endpoints are using the current auth user context, so it critical to always wrap them into the `auth` middleware.

### Conversations

[](#conversations)

MethodURLDescription`GET``/conversations`List all conversations the authenticated user is a member of.`GET``/conversations/{id}`Retrieve a single conversation by its ID.`DELETE``/conversations/{id}`Delete a conversation.`GET``/users/{userId}/conversation`Get the private conversation between the authenticated user and the specified user.### Messages

[](#messages)

MethodURLDescription`GET``/messages`List of messages related to the current user's conversations.`POST``/messages`Create a new message.`POST``/messages/{id}/read-to`Mark all messages in the target message's conversation as read up to the specified message ID.`POST``/messages/{id}/pin`Pin a message to its conversation.`POST``/messages/{id}/unpin`Unpin a message from its conversation.Broadcast Events
----------------

[](#broadcast-events)

The package uses Laravel's broadcasting system to notify conversation members in real time. All events are delivered over private channels named `chat.{userId}`, where `{userId}` is the ID of the recipient.

### Channel Authorization

[](#channel-authorization)

A user may listen on only his own private channel `chat.{userId}`. The channel is authorized when the authenticated user's ID matches `{userId}`.

### Events

[](#events)

#### `conversation.created`

[](#conversationcreated)

Sent to all conversation members **except the creator** when a new conversation is created.

This event is triggered when:

- A new group conversation is created.
- A private conversation is created implicitly (e.g., when a user sends the first message to another user via `recipient_id`).

**Payload:**

```
{
    "id": 1,
    "type": "private|group",
    "title": "string or null",
    "last_updated_at": "2024-01-01T00:00:00.000000Z",
    "created_at": "2024-01-01T00:00:00.000000Z",
    "last_message": { /* MessageResource */ }
}
```

---

#### `conversation.updated`

[](#conversationupdated)

Sent to **all conversation members** when a conversation is modified.

This event is triggered when:

- A conversation's properties (e.g., title, cover) are updated.
- A new message is created (the conversation's `last_updated_at` is updated as a side effect).
- A message is pinned or unpinned in the conversation.

**Payload:**

```
{
    "id": 1,
    "type": "private|group",
    "title": "string or null",
    "last_updated_at": "2024-01-01T00:00:00.000000Z",
    "created_at": "2024-01-01T00:00:00.000000Z",
    "last_message": { /* MessageResource */ },
    "pinned_messages": [ /* MessageResource */ ],
    "members_count": 2,
    "unread_messages_count": 0
}
```

---

#### `conversation.deleted`

[](#conversationdeleted)

Sent to all conversation members **except the user who deleted it** when a conversation is removed.

This event is triggered when:

- A conversation is deleted via `DELETE /conversations/{id}`.

**Payload:**

```
{
    "id": 1
}
```

---

#### `message.created`

[](#messagecreated)

Sent to all conversation members **except the sender** when a new message is posted.

This event is triggered when:

- A message is created via `POST /messages`.

**Payload:**

```
{
    "id": 1,
    "text": "Hello!",
    "conversation_id": 1,
    "is_read": false,
    "created_at": "2024-01-01T00:00:00.000000Z",
    "updated_at": "2024-01-01T00:00:00.000000Z",
    "sender": { /* UserResource */ }
}
```

---

#### `message.updated`

[](#messageupdated)

Sent to **all conversation members** when the read status of one or more messages changes.

This event is triggered when:

- A user marks messages as read via `POST /messages/{id}/read-to`.

**Payload:**

```
{
    "id": 1,
    "text": "Hello!",
    "conversation_id": 1,
    "is_read": true,
    "created_at": "2024-01-01T00:00:00.000000Z",
    "updated_at": "2024-01-01T00:00:00.000000Z",
    "sender": { /* UserResource */ }
}
```

Contributing
------------

[](#contributing)

Thank you for considering contributing to the Laravel Chat plugin! The contribution guide can be found in the [Contributing guide](CONTRIBUTING.md).

License
-------

[](#license)

Laravel Chat plugin is open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance76

Regular maintenance activity

Popularity21

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~48 days

Recently: every ~13 days

Total

22

Last Release

32d ago

PHP version history (2 changes)0.0.1-betaPHP &gt;=7.4.0

0.0.2-betaPHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1585993?v=4)[Evgeny Leonov](/maintainers/eleonov)[@eleonov](https://github.com/eleonov)

![](https://avatars.githubusercontent.com/u/129854316?v=4)[DPankratov](/maintainers/DPankratov)[@dpankratov](https://github.com/dpankratov)

---

Top Contributors

[![DenTray](https://avatars.githubusercontent.com/u/9486872?v=4)](https://github.com/DenTray "DenTray (107 commits)")[![pirs1337](https://avatars.githubusercontent.com/u/98943794?v=4)](https://github.com/pirs1337 "pirs1337 (88 commits)")[![RGO230](https://avatars.githubusercontent.com/u/76399317?v=4)](https://github.com/RGO230 "RGO230 (35 commits)")[![NikitaYakovlev](https://avatars.githubusercontent.com/u/36948499?v=4)](https://github.com/NikitaYakovlev "NikitaYakovlev (26 commits)")[![vitgrams](https://avatars.githubusercontent.com/u/126395087?v=4)](https://github.com/vitgrams "vitgrams (21 commits)")[![artengin](https://avatars.githubusercontent.com/u/152782500?v=4)](https://github.com/artengin "artengin (10 commits)")[![yogyrton](https://avatars.githubusercontent.com/u/90783599?v=4)](https://github.com/yogyrton "yogyrton (6 commits)")[![Adil9994](https://avatars.githubusercontent.com/u/32493535?v=4)](https://github.com/Adil9994 "Adil9994 (5 commits)")[![t0xas](https://avatars.githubusercontent.com/u/9395445?v=4)](https://github.com/t0xas "t0xas (4 commits)")[![yburlakov](https://avatars.githubusercontent.com/u/3166802?v=4)](https://github.com/yburlakov "yburlakov (2 commits)")[![milliyin](https://avatars.githubusercontent.com/u/55222179?v=4)](https://github.com/milliyin "milliyin (1 commits)")[![AZabolotnikov](https://avatars.githubusercontent.com/u/110885041?v=4)](https://github.com/AZabolotnikov "AZabolotnikov (1 commits)")[![astorozhevsky](https://avatars.githubusercontent.com/u/11055414?v=4)](https://github.com/astorozhevsky "astorozhevsky (1 commits)")

---

Tags

laravelchat

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/ronasit-laravel-chat/health.svg)

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

###  Alternatives

[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

23.9k69.5k](/packages/grumpydictator-firefly-iii)[ronasit/laravel-entity-generator

Provided console command for generating entities.

2053.1k](/packages/ronasit-laravel-entity-generator)[firefly-iii/data-importer

Firefly III Data Import Tool.

8035.8k](/packages/firefly-iii-data-importer)[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

17878.9k](/packages/markwalet-nova-modal-response)[ronasit/laravel-helpers

Provided helpers function and some helper class.

2085.6k31](/packages/ronasit-laravel-helpers)[team-nifty-gmbh/tall-datatables

Server-side rendered datatables for Laravel and Livewire

1320.9k4](/packages/team-nifty-gmbh-tall-datatables)

PHPackages © 2026

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