A Laravel package that adds friendship management capabilities to Eloquent models, enabling social features like friend requests and groups.
Laravel Friendships is a PHP package for Laravel that adds friendship management functionality to Eloquent models. It allows developers to implement social features like friend requests, blocking, and friend grouping in their applications with minimal setup. The package solves the need for a standardized, reusable way to handle user relationships in Laravel-based social platforms.
Laravel developers building applications that require user-to-user relationships, such as social networks, community platforms, or any app with friend/connection features.
Developers choose Laravel Friendships because it provides a ready-made, well-tested solution with an expressive API that aligns with Laravel's conventions, saving time compared to building custom friendship logic from scratch. Its trait-based design keeps models clean and integrates seamlessly with existing Laravel projects.
This package gives Eloquent models the ability to manage their friendships.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Methods like `$user->befriend($recipient)` and `$user->acceptFriendRequest($sender)` align with Laravel's fluent syntax, making integration intuitive for developers familiar with the framework.
Fires events such as 'friendships.accepted' and 'friendships.blocked' for key actions, enabling easy hooks for notifications or logging without modifying core package logic.
Allows customization of groups via config/friendships.php (e.g., 'close_friends', 'family') with methods like `groupFriend()` for organized relationship management.
Provides paginated queries for friends, pending requests, mutual friends, and more, as shown with `getFriends($perPage)` and `getMutualFriends($otherUser, $perPage)` in the README.
For Laravel versions below 5.5, users must manually add the service provider to config/app.php, adding complexity compared to auto-discovery in modern Laravel.
Focuses only on friendships; lacks built-in support for other common social interactions like messaging, reactions, or asymmetric follows, requiring additional packages or custom code.
The README points to test files for usage examples, suggesting official documentation may be minimal for advanced scenarios like performance optimization or custom event handling.