PHPackages                             centrex/laravel-messages - 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. centrex/laravel-messages

ActiveLibrary

centrex/laravel-messages
========================

Manage messages in laravel

v1.1.0(1y ago)0391[4 PRs](https://github.com/centrex/laravel-messages/pulls)MITPHPPHP ^8.2|^8.3|^8.4CI passing

Since Nov 15Pushed 1mo agoCompare

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

READMEChangelogDependencies (14)Versions (10)Used By (0)

Manage messages in Laravel
==========================

[](#manage-messages-in-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/913945ca812c13a2ee17d765ce9f7ae8268f5058975d2058dece0e6b7eb7e81e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f63656e747265782f6c61726176656c2d6d657373616765732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/centrex/laravel-messages)[![GitHub Tests Action Status](https://camo.githubusercontent.com/4c243aa8289fa8a015e423b8d77bbcff2e1f2cd8e6b1ee560109c59322cf6755/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f63656e747265782f6c61726176656c2d6d657373616765732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/centrex/laravel-messages/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/905708ecf1cd60b60cfac22a34105860f49c630806a80030eb0dc6bc1d6f1bd7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f63656e747265782f6c61726176656c2d6d657373616765732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/centrex/laravel-messages/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/35d65e1051c52830e89f7cf69f4e7212d5b2c1b906ad154f743d8a9000ac651d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f63656e747265782f6c61726176656c2d6d657373616765733f7374796c653d666c61742d737175617265)](https://packagist.org/packages/centrex/laravel-messages)

Thread-based polymorphic messaging for any Eloquent model. Supports multi-participant conversations, read/unread tracking, and soft-deletes on both threads and messages.

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

[](#installation)

```
composer require centrex/laravel-messages
php artisan vendor:publish --tag="laravel-messages-migrations"
php artisan migrate
```

Usage
-----

[](#usage)

### 1. Add the trait to your model

[](#1-add-the-trait-to-your-model)

```
use Centrex\Messages\Concerns\HasMessages;

class User extends Authenticatable
{
    use HasMessages;
}
```

### 2. Create a thread and add messages

[](#2-create-a-thread-and-add-messages)

```
use Centrex\Messages\Models\Thread;

// Create a new thread
$thread = Thread::create(['subject' => 'Order inquiry']);

// Add participants
$thread->addParticipant($user);
$thread->addParticipant($support);
// or multiple at once
$thread->addParticipants([$user, $support, $manager]);

// Post a message
$thread->addMessage(['body' => 'When will my order ship?'], $user);
```

### 3. Read threads and messages

[](#3-read-threads-and-messages)

```
// All threads a user participates in
$user->threads;

// Threads with unread messages
Thread::forModelWithNewMessages($user)->get();

// All threads for a participant
Thread::forModel($user)->get();

// Latest message in a thread
$thread->getLatestMessage();

// All messages in a thread
$thread->messages;

// Who started the thread
$thread->creator();
```

### 4. Unread tracking

[](#4-unread-tracking)

```
// Mark thread as read by user
$thread->markAsRead($user);

// Check if thread has unread messages for user
$thread->isUnread($user);  // bool

// Count of threads with new messages
$user->newMessagesCount();

// IDs of threads with new messages
$user->threadsWithNewMessages();
```

### 5. Participant management

[](#5-participant-management)

```
$thread->hasParticipant($user);   // bool
$thread->activateAllParticipants(); // restore soft-deleted participants
```

Testing
-------

[](#testing)

```
composer test        # full suite
composer test:unit   # pest only
composer test:types  # phpstan
composer lint        # pint
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [centrex](https://github.com/centrex)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance71

Regular maintenance activity

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 91.7% 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

Every ~111 days

Total

5

Last Release

461d ago

PHP version history (3 changes)v1.0.0PHP ^8.0|^8.1

v1.0.2PHP ^8.1|^8.2

v1.1.0PHP ^8.2|^8.3|^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/3b62fd49922fd1bf7d55b94cc82ebc9f359af7f343b246a7e3a2642779c0b4e7?d=identicon)[rochi88](/maintainers/rochi88)

---

Top Contributors

[![rochi88](https://avatars.githubusercontent.com/u/29769944?v=4)](https://github.com/rochi88 "rochi88 (33 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")

---

Tags

laravelcentrexlaravel messages

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/centrex-laravel-messages/health.svg)

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)

PHPackages © 2026

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