Download the PHP package rennokki/befriended without Composer

On this page you can find all versions of the php package rennokki/befriended. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package befriended

Laravel Befriended

CI codecov StyleCI Latest Stable Version Total Downloads Monthly Downloads License

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

🤝 Supporting

If you are using one or more Renoki Co. open-source packages in your production apps, in presentation demos, hobby projects, school projects or so, sponsor our work with Github Sponsors. 📦

🚀 Installation

Install the package:

Publish the config:

Publish the migrations:

🙌 Usage

The power of example is better here. This package allows you simply to assign followers, blockings or likes without too much effort. What makes the package powerful is that you can filter queries using scopes out-of-the-box.

Following

To follow other models, your model should use the CanFollow trait and Follower contract.

The other models that can be followed should use CanBeFollowed trait and Followable contract.

If your model can both follow & be followed, you can use Follow trait and Following contract.

Let's suppose we have an User model which can follow and be followed. Within it, we can now check for followers or follow new users:

Now, let's suppose we have a Page model, than can only be followed:

By default, if querying following() and followers() from the User instance, the relationships will return only User instances. If you plan to retrieve other instances, such as Page, you can pass the model name or model class as an argument to the relationships:

On-demand, you can check if your model follows some other model:

Some users might want to remove followers from their list. The Followable trait comes with a revokeFollower method:

Note: Following, unfollowing or checking if following models that do not correctly implement CanBeFollowed and Followable will always return false.

Filtering followed/unfollowed models

To filter followed or unfollowed models (which can be any other model) on query, your model which you will query should use the Rennokki\Befriended\Scopes\FollowFilterable trait.

If your User model can only like other Page models, your Page model should use the trait mentioned.

Blocking

Most of the functions are working like the follow feature, but this is helpful when your models would like to block other models.

Use CanBlock trait and Blocker contract to allow the model to block other models.

Adding CanBeBlocked trait and Blockable contract sets the model able to be blocked.

For both, you should be using Block trait & Blocking contract:

Most of the methods are the same:

Filtering blocked models

Blocking scopes provided takes away from the query the models that are blocked. Useful to stop showing content when your models blocks other models.

Make sure that the model that will be queried uses the Rennokki\Befriended\Scopes\BlockFilterable trait.

Liking

Apply CanLike trait and Liker contract for models that can like:

CanBeLiked and Likeable trait can be used for models that can be liked:

Planning to use both, use the Like trait and Liking contact:

As you have already got started with, these are the methods:

Filtering liked content

Filtering liked content can make showing content easier. For example, showing in the news feed posts that weren't liked by an user can be helpful.

The model you're querying from must use the Rennokki\Befriended\Scopes\LikeFilterable trait.

Let's suppose there are 10 pages in the database.

Follow requests

This is similar to the way Instagram allows you to request follow of a private profile.

To follow other models, your model should use the CanFollow trait and Follower contract.

The other models that can be followed should use CanBeFollowed trait and Followable contract.

If your model can both follow & be followed, you can use Follow trait and Following contract.

Let's suppose we have an User model which can follow and be followed. Within it, we can now check for follower requests or request to follow a users:

Now, let's suppose we have a Page model, than can only be followed:

You can then request or cancel the follow requests:

The one being followed can accept or decline the requests:

By default, if querying followRequests() and followerRequests() from the User instance, the relationships will return only User instances.

If you plan to retrieve other instances, such as Page, you can pass the model name or model class as an argument to the relationships:

Note: Requesting, accepting, declining or checking if following models that do not correctly implement CanBeFollowed and Followable will always return false.

🐛 Testing

🤝 Contributing

Please see CONTRIBUTING for details.

🔒 Security

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

🎉 Credits


All versions of befriended with dependencies

PHP Build Version
Package Version
Requires doctrine/dbal Version ^2.10|^3.3
illuminate/database Version ^8.83|^9.0.1
illuminate/support Version ^8.83|^9.0.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rennokki/befriended contains the following files

Loading the files please wait ....