PHPackages                             metko/galera - 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. metko/galera

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

metko/galera
============

Messaging/chatting package for laravel

v1.0.0(6y ago)018MITPHPCI failing

Since Dec 6Pushed 6y agoCompare

[ Source](https://github.com/metko/galera)[ Packagist](https://packagist.org/packages/metko/galera)[ RSS](/packages/metko-galera/feed)WikiDiscussions master Synced 3d ago

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

galera
======

[](#galera)

Galera is small package to handle conversation between two or multiple user.

### Installations

[](#installations)

---

###### Step 1

[](#step-1)

```
composer require metko/galera
```

###### Step 2

[](#step-2)

Publish the config file and the asset

```
php artisan pusblish --tag:galera
```

How to use it
-------------

[](#how-to-use-it)

### Usage

[](#usage)

#### Use the trait

[](#use-the-trait)

Use the trait Galerable in your user model

```
// Metko\Galera\Galerable;
use Galerable;
```

#### Conversation

[](#conversation)

###### Create a conversation

[](#create-a-conversation)

```
Galera::participants($user1, $user2)->make();
*// Or pass an array of multiple user*
Galera::addParticipants([1,2,3,'10'])->make();
```

###### Get a conversation

[](#get-a-conversation)

```
Galera::conversation($id);
// Or with the messages
Galera::conversation($id, true);
```

\*Return a conversation with \[‘messages\_count’, ’unread\_messages\_count’\] by default \*

###### Clear a conversation

[](#clear-a-conversation)

```
Galera::conversation($id)->clear();
```

*Will soft delete all the message of the given conversation*

###### Close a conversation

[](#close-a-conversation)

```
Galera::conversation($id)->close(); return Metko\Galera\Conversation
```

*Nobody can submit a message in a close conversation*

###### Check if a conversation is closed

[](#check-if-a-conversation-is-closed)

```
Galera::conversation($id)->isCLosed(); // return bool
```

###### Add participants in a conversation

[](#add-participants-in-a-conversation)

```
Galera::conversation($id)->add(1);
// Or many user at the same time
Galera::conversation($id)->addMany([1, $user2, '3']);
```

###### A Conversation can remove a participant

[](#a-conversation-can-remove-a-participant)

```
Galera::conversation($id)->remove(1);
```

*A conversation must have at least 2 participants. It will return an error if you try to do it.*

###### Read all message of a conversation

[](#read-all-message-of-a-conversation)

```
Galera::conversation($id)->readAll();
```

*A conversation must have at least 2 participants. It will return an error if you try to do it.*

#### User

[](#user)

###### A user can write a message

[](#a-user-can-write-a-message)

```
$user->write(‘My message’, $conversationId); // You can pass a model or an id for the conversation
```

###### Delete a message

[](#delete-a-message)

```
Galera::message(1)->delete(); // You can pass a model or an id for the conversation param*
```

###### Write a message refering another

[](#write-a-message-refering-another)

```
$user->write(‘My message’, $conversationId, $message->id); // You can pass a model or an id for the message param*
```

###### Check if a user has unread message on a specific conversation

[](#check-if-a-user-has-unread-message-on-a-specific-conversation)

```
$user->hasUnreadMessage($convzersationId); // Return bool
//Or in all conversation where he is participant
$user->hasUnreadMessage(); // Return bool
```

###### Get unread messages for user

[](#get-unread-messages-for-user)

```
$user->unreadMessages();
```

###### Read all the message unread for a user in a conversation

[](#read-all-the-message-unread-for-a-user-in-a-conversation)

```
$user->readAll($convzersationId); // Return Collection
```

*Return a list of all conversation ordered by updated\_at, count of message, and unread\_message\_count*

###### Get the last conversation of a user

[](#get-the-last-conversation-of-a-user)

```
$user->getLastConversation($withMessage = false, $nbMessage = 25); // Return Collection
```

*Return a list of all conversation ordered by updated\_at, count of message, and unread\_message\_count*

#### Messagess

[](#messagess)

###### Get messages from a conversation

[](#get-messages-from-a-conversation)

```
Galera::ofConversation($conversationId)->get();
```

###### Get a unread\_message count in conversation

[](#get-a-unread_message-count--in-conversation)

```
Galera::conversation($id)->unread_messages_count;
```

###### Get a total\_message count n conversation

[](#get-a-total_message--count-n-conversation)

```
Galera::conversation($id)->messages_count;
```

Test cases
----------

[](#test-cases)

The package includes three test cases:

- `TestCase` - Effectively the normal Laravel test case. Use it the same way you would your normal Laravel test case
- `SimpleTestCase` - Extends the default PHPUnit test case, so it doesn’t set up a Laravel application, making it quicker and well-suited to properly isolated unit tests
- `BrowserKitTestCase` - Sets up BrowserKit

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

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

Unknown

Total

1

Last Release

2400d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7676725?v=4)[Thomas Moiluiavon](/maintainers/metko)[@metko](https://github.com/metko)

---

Top Contributors

[![metko](https://avatars.githubusercontent.com/u/7676725?v=4)](https://github.com/metko "metko (16 commits)")

---

Tags

laravellumen

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/metko-galera/health.svg)

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

###  Alternatives

[laracrafts/laravel-url-shortener

Powerful URL shortening tools in Laravel

98112.5k](/packages/laracrafts-laravel-url-shortener)[proai/lumen-annotations

Route and event binding annotations for Laravel Lumen

1012.6k](/packages/proai-lumen-annotations)

PHPackages © 2026

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