Download the PHP package kesty/laravel-reactions without Composer

On this page you can find all versions of the php package kesty/laravel-reactions. 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 laravel-reactions

Laravel Reactions

Latest Version on Packagist Build Status Total Downloads

Laravel Reactions is the package you need if you want to implement reactions for your Eloquent models, similarly you can see on Facebook.

Features

Disclaimer

This project is not associated with Facebook in any way. I've used the "reactions" just to give an idea of the concept. In case of legal issues, let me know using an email.

Install

Install the package with Composer.

Add the Service Provider to your config/app.php file.

Run the migrations to create reactions and reactables tables.

You're good to go.

Usage

Add Traits to Models

To use the package you need to follow two steps:

Let's make an example.

Imagine that you have some users in your application. You are building a blog, so you will have posts.

You want to let your user add reactions to your posts. Just like Facebook, you know.

Let's say we have two models: User and Post.

Following the steps, we first add the Kesty\LaravelReactions\Traits\Reacts trait to our User model.

Done! Now, to the Post model!

Ta-dah! You're done.

By default, the package ships with a Reaction model. This model has a single, simple property: its name. You can create a new one easily, with

React!

Our models are ready. We can use them. How?

Easy, isn't it? The reactTo method handles everything for you.

Get Reactions for a Model

Just like you can let one of your entities react to another one, you should be able to get all the reactions for an entity.

Let's see how to do it.

In $reactions you will have a collection of Reaction models, ready to be used.

Get a Reactions Summary

Probably you won't need everything about reactions to a specific entity everytime. So, I implemented a getReactionsSummary for you.

In $reactionsSummary you will find a collection of items, composed by two properties: name and count. Imagine that we do something like the following code in a controller:

Here's what we will get:

Accessing the "Responder"

When on Facebook, you can see "who" reacted in some way to a post. To get that who you can use the getResponder method. This works for every reaction you get using the reactions relationship method, of course.

Let's assume that a User named "Francesco" already reacted with the "love" reaction to a post.

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

Contributing

Please see CONDUCT for details.

Security

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

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-reactions with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/database Version ~5.5|~5.6|~5.7|~5.8|^6.0|^7.0|^8.0|^9.0
illuminate/support Version ~5.5|~5.6|~5.7|~5.8|^6.0|^7.0|^8.0|^9.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 kesty/laravel-reactions contains the following files

Loading the files please wait ....