PHPackages                             inani/messager - 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. inani/messager

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

inani/messager
==============

A simple package to handle messages

1.0.2(9y ago)1522.6k16[6 issues](https://github.com/akiyamaSM/messager/issues)MITPHPCI failing

Since Jan 5Pushed 6y ago9 watchersCompare

[ Source](https://github.com/akiyamaSM/messager)[ Packagist](https://packagist.org/packages/inani/messager)[ RSS](/packages/inani-messager/feed)WikiDiscussions master Synced 3w ago

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

(NOT MAINTAINED)

Laravel Messager
================

[](#laravel-messager)

A convenient way to handle messages between users in a simple way

**Table of Contents**

1. [Installation](#installation)
2. [Setup a Model](#setup-a-model)
3. [Creating &amp; Sending Messages](#creating--sending-messages)
    1. [Creating a message](#creating-a-message)
    2. [Sending the message](#sending-the-message)
    3. [Responding the message](#responding-the-message)
    4. [Drafting a message](#drafting-a-message)
4. [Working with Messages](#working-with-messages)
    1. [Getting messages between users](#getting-messages-between-users)
    2. [Read messages](#read-messages)
    3. [Unread messages](#unread-messages)
    4. [Draft messages](#draft-messages)
5. [Tags](#tags)
    1. [Create and Edit tags](#create-and-edit-tags)
    2. [Assign tag to message](#assign-tag-to-message)
    3. [Change and get tag of a message](#change-and-get-tag-of-a-message)
    4. [Remove a tag from a message](#remove-a-tag-from-a-message)

Installation:
-------------

[](#installation)

First, install the package through Composer.

```
composer require inani/messager
```

Then include the service provider inside `config/app.php`.

```
'providers' => [
    ...
    Inani\Messager\MessagerServiceProvider::class,
    ...
];
```

Publish config and migrations

```
php artisan vendor:publish

```

---

Setup a Model
-------------

[](#setup-a-model)

To setup a model all you have to do is add (and import) the `MessageAccessible` trait.

```
use Inani\Messager\Helpers\MessageAccessible;
use Inani\Messager\Helpers\TagsCreator;
class User extends Model
{
    use MessageAccessible, TagsCreator;
    ...
}
```

---

Creating &amp; sending Messages
-------------------------------

[](#creating--sending-messages)

### Creating a message

[](#creating-a-message)

```
$receiver = User::find(1);

// Message Data
$messageData = [
	'content' => 'Hello all this is just a test', // the content of the message
	'to_id' => $receiver->getKey(), // Who should receive the message
];

list($message, $user) = App\User::createFromRequest($messageData);
```

### Sending the message

[](#sending-the-message)

```
$sender = User::find(2);

$sent = $sender->writes($message)
                 ->to($user)
                 ->send();

// send to multiple users the same message
// can execpt a user|array of users| array of ids| or array of users and ids
$sent = $sender->writes($message)
                 ->to($user)
		 ->cc([$user1, $user2])
		 ->cc([$user3->id, $user4->id])
                 ->send();
```

### Responding the message

[](#responding-the-message)

```
$sender = User::find(2);

$sent = $user->writes($newMessage)
                 ->to($sender)
		 ->responds($message)
                 ->send();
```

### Drafting a message

[](#drafting-a-message)

```
$sender = User::find(2);

$draft = $sender->writes($message)
                  ->to($user)
                  ->draft()
                  ->keep();
```

---

Working with Messages
---------------------

[](#working-with-messages)

Once you've got messages you need to do something with them.

### Getting messages between users

[](#getting-messages-between-users)

```
// Users
$userA = App\User::find(1);
$userB = App\User::find(2);

// Get seen messages sent from UserB to UserA
$messages = $userA->received()->from($userB)->seen()->get();

// OR you can pass an array of IDs
$messages = $userA->received()->from([2, 3, 4, 5])->seen()->get();
```

### Read messages

[](#read-messages)

```
// Set the selected message(or id of messages as read)
$count = $userB->received()->select($message)->readThem();
```

### Unread messages

[](#unread-messages)

```
// Get unread messages from UserB to User A
$messages = $userA->received()->from($userB)->unSeen()->get();

// Marking them as read
$messages = $userA->received()->from($userB)->unSeen()->readThem();

// check out if a conversation has new messages
$bool = $userA->received()->conversation($message)->hasNewMessages();

// Get the number of conversations that have new messages in it
$number = $userA->received()->unSeenConversations();
```

### Sent messages

[](#sent-messages)

```
// Get unread messages from UserA to UserB
$messages = $userA->sent()->to($userB)->get();

// OR you can pass an array of IDs
$messages = $userA->received()->to([2, 3, 4, 5)->get();
```

### Draft messages

[](#draft-messages)

```
// Get the draft messages for UserA
$messages = $userA->sent()->inDraft()->get().
```

Tags
----

[](#tags)

You can tag (or structure your messages in different categories).

### Create and Edit tags

[](#create-and-edit-tags)

each user can make any number of tags.

```
// create a new tag, $data can be (Tag instance, array, Request)
$tag = $userA->addNewTag($data);

// Modify the attributes of a tag
$user->tag($tag)->name("social")->color("#ffff")->apply();
```

### Assign tag to message

[](#assign-tag-to-message)

Once you have the message and the tag

```
// you'll need the instance of user(to check if sender or receiver)
// $user and $tag can be ids or instance of User, Tag classes
$bool = $message->concerns($user)->putTag($tag);
```

### Change and get tag of a message

[](#change-and-get-tag-of-a-message)

```
// to change the tag just use the same method
$bool = $message->concerns($user)->putTag($tag);

// to get the tag of the message, null if not tagged
$tagOrNull = $message->concerns($user)->getTag();
//
```

### Remove a tag from a message

[](#remove-a-tag-from-a-message)

```
// To remove the tag from the message
$bool = $message->concerns($user)->removeTag();
```

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 93% 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 ~52 days

Total

2

Last Release

3396d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0fbeb774293770efe72dfe486b323e999e6d65d0df0db9052a1e5b76d9711efe?d=identicon)[akiyamaSM](/maintainers/akiyamaSM)

---

Top Contributors

[![akiyamaSM](https://avatars.githubusercontent.com/u/12276076?v=4)](https://github.com/akiyamaSM "akiyamaSM (53 commits)")[![simondotwhite](https://avatars.githubusercontent.com/u/793770?v=4)](https://github.com/simondotwhite "simondotwhite (2 commits)")[![Jason-Cooke](https://avatars.githubusercontent.com/u/5185660?v=4)](https://github.com/Jason-Cooke "Jason-Cooke (1 commits)")[![Sekonda](https://avatars.githubusercontent.com/u/127744940?v=4)](https://github.com/Sekonda "Sekonda (1 commits)")

---

Tags

convenientlaravelmessaging

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/inani-messager/health.svg)

```
[![Health](https://phpackages.com/badges/inani-messager/health.svg)](https://phpackages.com/packages/inani-messager)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M11](/packages/renatomarinho-laravel-page-speed)[illuminate/pipeline

The Illuminate Pipeline package.

9348.3M267](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10533.5M989](/packages/illuminate-pagination)[illuminate/redis

The Illuminate Redis package.

8314.4M362](/packages/illuminate-redis)[illuminate/cookie

The Illuminate Cookie package.

224.5M132](/packages/illuminate-cookie)

PHPackages © 2026

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