Download the PHP package triggerdesign/hermes without Composer
On this page you can find all versions of the php package triggerdesign/hermes. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package 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
- Conversation -> hasMany Users
- Conversation -> hasMany Messages
- Message -> hasOne User
- Message -> hasMany MessageState
- MessageState -> 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
For Laravel 5
For Laravel 4
Run a composer update.
Step 2: app.php
Step 3: Publish migrations and config
Now you have the 4 tables that we need for user conversations.
Step 4: Use the user trait
You should use a trait inside your User model:
Usage
Start a new conversation or find an existing one
Start a converstion between user with the ID 1 and the user with the ID 2. If there is allready one it will return the existing conversation.
Now you have access to these functions and attributes:
You can also have groups of messages like in facebook. Several messages are collected into a group of messages, if they is not too much time in between and if they are all from one sender.
Access the conversations of a user
The trait allows you to use these functions:
Configuration
The configuration files are published into your app directory.
- If you dont use the "users" table for storing your users you can rename it in hermes.usersTable
- Change the tableprefix if you want to: hermes.tablePrefix