PHPackages                             merodiro/friendships - 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. [Database &amp; ORM](/categories/database)
4. /
5. merodiro/friendships

ActiveLibrary[Database &amp; ORM](/categories/database)

merodiro/friendships
====================

This package gives users the ability to manage their friendships.

v1.2.4(7y ago)459.7k3[1 PRs](https://github.com/merodiro/Friendships/pulls)MITPHPPHP &gt;=7.0.0

Since May 8Pushed 5y agoCompare

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

READMEChangelog (10)Dependencies (4)Versions (19)Used By (0)

Laravel 5 Friendships
=====================

[](#laravel-5-friendships)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f72163c899e7186312ef579d0cbbcf957d215e1762ed6de36aa51eb319dfcedd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d65726f6469726f2f667269656e6473686970732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/merodiro/friendships)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/44bd40aee37e00f9a6dfafe900c13336a6e8ef92411cd528e546821c9c4e0d58/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6d65726f6469726f2f467269656e6473686970732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/merodiro/Friendships)[![Build status](https://camo.githubusercontent.com/a0363d98bb4ae0fc30922a7116bcedc5b75a02ea33216b13aaab569239020689/68747470733a2f2f63692e6170707665796f722e636f6d2f6170692f70726f6a656374732f7374617475732f3663696f396973646e686d64786c38723f7376673d74727565)](https://ci.appveyor.com/project/merodiro/friendships)[![Coverage Status](https://camo.githubusercontent.com/4b88e2c8eebab495b2a3830bc0c18dfc0e3c75795b7a5ced7db8327eef401501/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6d65726f6469726f2f467269656e6473686970732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/merodiro/Friendships/code-structure)[![Quality Score](https://camo.githubusercontent.com/a7b7b26b6f2268f202f4e6dd9b0bd37b04de8b95477bf4797b6c4cc1403c2dd5/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6d65726f6469726f2f467269656e6473686970732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/merodiro/Friendships)[![Total Downloads](https://camo.githubusercontent.com/35890df46bc6c70eab4e23957396ef08b98c219083c0b63fd93f9f12d74a772e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d65726f6469726f2f667269656e6473686970732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/merodiro/friendships)

This package gives users the ability to manage their friendships.

Models can:
-----------

[](#models-can)

- Send Friend Requests
- Accept Friend Requests
- Deny Friend Requests
- Delete Friend

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

[](#installation)

First, install the package through Composer.

```
composer require merodiro/friendships
```

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

```
'providers' => [
    ...
    Merodiro\Friendships\FriendshipsServiceProvider::class,
    ...
];
```

Finally, migrate the database

```
php artisan migrate

```

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

[](#setup-a-model)

```
use Merodiro\Friendships\Friendable;
class User extends Model
{
    use Friendable;
    ...
}
```

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

[](#how-to-use)

[Check the Test file to see the package in action](https://github.com/merodiro/Friendships/blob/master/tests/FriendshipsTest.php)

#### Send a Friend Request

[](#send-a-friend-request)

```
$user->addFriend($recipient);
```

#### Accept a Friend Request

[](#accept-a-friend-request)

```
$user->acceptFriend($sender);
```

#### Deny a Friend Request

[](#deny-a-friend-request)

```
$user->deleteFriend($sender);
```

#### Remove Friend

[](#remove-friend)

```
$user->deleteFriend($friend);
```

#### Mutual Friends

[](#mutual-friends)

```
$user->mutualFriends($anotherUser);
```

#### check the current relationship between two users

[](#check-the-current-relationship-between-two-users)

```
$user->checkFriendship($anotherUser);
```

it returns

- `same_user` =&gt; if the `$user` is checking his own account
- `friends` =&gt; if they are friends
- `waiting` =&gt; if `$user` sent a request waiting for approval from `$anotherUser`
- `pending` =&gt; if `$anotherUser` user sent a request waiting for approval from `$user`
- `not_friends` =&gt; if they are not friends

#### Check if two users are friends

[](#check-if-two-users-are-friends)

```
$user->isFriendsWith($anotherUser);
```

it returns `true` if they are friends and `false` if they aren't

Friends
-------

[](#friends)

To get a collection of users use the following methods:

#### Get Friends

[](#get-friends)

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

#### Get a list of users that `$user` has received friend requests from

[](#get-a-list-of-users-that-user-has-received-friend-requests-from)

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

#### Get a list of users that `$user` has sent friend requests to

[](#get-a-list-of-users-that-user-has-sent-friend-requests-to)

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

Events
------

[](#events)

This is the list of the events fired by default for each action

Event nameFiredfriendrequest.sentWhen a friend request is sentfriendrequest.acceptedWhen a friend request is acceptedfriendship.deletedWhen a friend request is deniedfriendship.deletedWhen a friendship is deletedfor more about how to use the events [Check this example](/Events.md)

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Amr A. Mohammed](https://github.com/merodiro)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity67

Established project with proven stability

 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

Every ~25 days

Recently: every ~0 days

Total

16

Last Release

2916d ago

Major Versions

v0.4.1 → v1.0.02017-12-01

PHP version history (2 changes)v0.1.2PHP &gt;=5.4.0

v1.2.0PHP &gt;=7.0.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/b54b6be57ce5ffc918681cd35cf9f16dd5977f37d8f8e93bae240ed20304a301?d=identicon)[merodiro](/maintainers/merodiro)

---

Top Contributors

[![merodiro](https://avatars.githubusercontent.com/u/17033502?v=4)](https://github.com/merodiro "merodiro (73 commits)")

---

Tags

friendshiplaravellaravel-5-packagelaraveleloquentfriendsfriendshipsfriend-system

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/merodiro-friendships/health.svg)

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

###  Alternatives

[multicaret/laravel-acquaintances

This light package, with no dependencies, gives Eloquent models the ability to manage friendships (with groups), verifications, and interactions such as: Likes, favorites, votes, subscribe, follow, ..etc. And it includes advanced rating system.

851266.9k2](/packages/multicaret-laravel-acquaintances)[hootlex/laravel-friendships

This package gives Eloquent models the ability to manage their friendships.

705114.6k](/packages/hootlex-laravel-friendships)[rennokki/befriended

Eloquent Befriended brings social media-like features like following, blocking and filtering content based on following or blocked models.

76292.2k1](/packages/rennokki-befriended)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)[highsolutions/eloquent-sequence

A Laravel package for easy creation and management sequence support for Eloquent models with elastic configuration.

121130.3k](/packages/highsolutions-eloquent-sequence)[demency/laravel-friendships

This package gives Eloquent models the ability to manage their friendships.

201.0k](/packages/demency-laravel-friendships)

PHPackages © 2026

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