PHPackages                             triggerdesign/hermes - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. triggerdesign/hermes

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

triggerdesign/hermes
====================

A fully featured messaging package for Laravel.

2.1(10y ago)167057[7 issues](https://github.com/triggerdesign/Hermes/issues)PHPPHP &gt;=5.3.0

Since May 9Pushed 10y ago3 watchersCompare

[ Source](https://github.com/triggerdesign/Hermes)[ Packagist](https://packagist.org/packages/triggerdesign/hermes)[ RSS](/packages/triggerdesign-hermes/feed)WikiDiscussions master Synced 1mo ago

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

Hermes
======

[](#hermes)

A fully featured messaging package for Laravel 4, 5 and 5.1.

You can have conversations between multiple users to build a messenger with rooms or just a private 1to1 message system.

The Idea
--------

[](#the-idea)

- Conversation -&gt; hasMany Users
- Conversation -&gt; hasMany Messages
- Message -&gt; hasOne User
- Message -&gt; hasMany MessageState
- MessageState -&gt; hasMany User

Like you see in the table above, Hermes is able to differ between different users when it comes to reading a message.

**For example:**

There is a conversation between 3 users: *User1, User2 and User3*.

*User1* writes a message and *User2* reads it.

Then we have three MessageStates for this new message:

- MessageState for User1 is ‘own’
- MessageState for User2 is ‘read’
- MessageState for User3 is ‘unread’

\##Install

### Step 1: Composer.json

[](#step-1-composerjson)

#### For Laravel 5

[](#for-laravel-5)

```
    "require": {
        ...
        "triggerdesign/hermes": "2.*"
        }
```

#### For Laravel 4

[](#for-laravel-4)

```
    "require": {
        ...
        "triggerdesign/hermes": "1.0"
        }
```

Run a **composer update**.

### Step 2: app.php

[](#step-2-appphp)

```
	'providers' => array(
	    ...
        \Triggerdesign\Hermes\HermesServiceProvider::class
	);
	...
	'aliases' => array(
	    ...
        'Messaging' => Triggerdesign\Hermes\Facades\Messaging::class
   );
```

### Step 3: Publish migrations and config

[](#step-3-publish-migrations-and-config)

```
    php artisan vendor:publish
    php artisan migrate

```

Now you have the 4 tables that we need for user conversations.

### Step 4: Use the user trait

[](#step-4-use-the-user-trait)

You should use a trait inside your **User model**:

```
