Download the PHP package developer-savyour/befriended without Composer

On this page you can find all versions of the php package developer-savyour/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

Build Status codecov StyleCI Latest Stable Version Total Downloads Monthly Downloads License

PayPal

Laravel Befriended

Eloquent Befriended brings social media-like features like following, blocking and filtering content based on following or blocked models. Laravel Befriended comes with scopes that manage filtering content that gives you easy control better what your user can see and cannot see.

Switching from 1.1.x to 1.2.x

The main difference is that the traits that are responsible for filtering content got a better eloquent capability.

Make sure you replace the following traits:

with the following ones that are paired by the action they filter:

Installation

Install the package:

If your Laravel version does not support package discovery, add this line in the providers array in your config/app.php file:

Publish the config file & migration files:

Migrate the database:

Example

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:

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.


All versions of befriended with dependencies

PHP Build Version
Package Version
Requires laravel/framework Version ~5.5|~6.0
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 developer-savyour/befriended contains the following files

Loading the files please wait ....