Download the PHP package hypefactors/laravel-follow without Composer
On this page you can find all versions of the php package hypefactors/laravel-follow. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hypefactors/laravel-follow
More information about hypefactors/laravel-follow
Files in hypefactors/laravel-follow
Package laravel-follow
Short Description Laravel 9 Follow System for Eloquent models.
License BSD-3-Clause
Homepage https://hypefactors.com
Informations about the package laravel-follow
Laravel Follow
Laravel 10 Follow System for Eloquent models.
This package is compliant with the FIG standards PSR-1, PSR-2 and PSR-4 to ensure a high level of interoperability between shared PHP. If you notice any compliance oversights, please send a patch via pull request.
Version Matrix
Version | Laravel | PHP Version |
---|---|---|
9.x | 10.x | >= 8.1 |
8.x | 9.x | >= 8.0 |
7.x | 8.x | >= 7.3 |
6.x | 7.x | >= 7.2.5 |
5.x | 6.x | >= 7.2 |
4.x | 5.8.x | >= 7.1 |
3.x | 5.7.x | >= 7.1 |
2.x | 5.6.x | >= 7.1 |
1.x | 5.5.x | >= 7.0 |
Installation
You can install the package via composer:
The package will be automatically registered.
Now you need to run the migrations:
Usage
Preparing the Eloquent Models
To allow an entity to be followed or to follow other entities, the corresponding models have to implement an interface and make usage of a trait.
Here's how we do it for a User
and Company
entity, where a user will be able to follow a company and the company will be able to be followed:
Note: If required, an entity can follow and can also be followed, just implement both interfaces and traits on the same model to achieve that requirement.
Following an Entity
You can follow an entity like this:
You can also perform the same through the entity that's going to be followed:
Follow Many Entities
You can follow many entities like this:
You can also perform the same through the entity that's going to be followed:
Unfollowing an Entity
You can unfollow an entity like this:
You can also perform the same through the entity that's going to be unfollowed:
Unfollow Many Entities
You can unfollow many entities like this:
You can also perform the same through the entity that's going to be unfollowed:
Determining if an Entity is Following another Entity
You can unfollow an entity like this:
You can also perform the same through the entity that's going to be followed:
Determine if an Entity has Followings
Determine if an Entity has Followers
Get list of Followings
To get a list of followings (entities another entity is following)
Get List of Followers
To get a list of followers (entities that are following an entity)
Get List of Followings by Entity Type
Get a list of followings (entities another entity is following) and filter by an entity type
Get List of Followers by Entity Type
Get a list of followers (entities that are following an entity) and filter by an entity type
Contributing
Thank you for your interest in Laravel Follow. Here are some of the many ways to contribute.
- Check out our contributing guide
- Look at our code of conduct
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
License
Laravel Follow is licenced under the BSD 3-Clause License. Please see the license file for more information.