Download the PHP package agilepixels/laravel-rateable without Composer

On this page you can find all versions of the php package agilepixels/laravel-rateable. 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?
agilepixels/laravel-rateable
Rate from 1 - 5
Rated 5.00 based on 1 reviews

Informations about the package laravel-rateable

Add ratings to Eloquent Models

Latest Version on Packagist Build Status StyleCI Quality Score Total Downloads

Imagine you want to add star ratings to an Eloquent Model. This package enables that feature for you. Ratings can be from 0 to 5 stars, +1/-1 or any other range you like.

This package provides a HasRatings and AddsRatings traits that, once installed on a model, allows you to do things like this:

Installation

You can install the package via composer:

The migrations for the ratings are loaded automatically. You can migrate the ratings table using:

A config file is included to specify the range for the ratings. By default, rating are between 0 and 5. However, you are free to use it otherwise. For instance, ratings like +1 or -1. You can publish the config-file with:

Using the trait

To enable the ratings for a model, use the AgilePixels\Rateable\Traits\HasRatings trait on the model.

If you would like to calculate the ratings for the author model, you may use the AgilePixels\Rateable\Traits\AddsRatings trait on your User model (or any other model that is able to add a rating).

Usage

The createRating Method

To create a rating for a model that HasRatings, you can use the creatRating() method. The method takes two variables: $rating and $author. The $rating can be an integer or a float within the range defined in your config file (default is 0 to 5). The $author refers to the model that AddsRatings which, in most cases, is your User model.

Optionally, you can also post a comment for a rating. This can be done through a third string variable called $body.

The createComment Method

Once a rating is created, you might want to respond to the rating as owner of the web application. This can be done using the createComment() method. The method takes two variables: $author and $body.

Calculations

Of course, you may want to display some data about the models ratings. This package provides three methods to do so:

The data is also available as accessor. You may access the data like this:

Credits

License

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


All versions of laravel-rateable with dependencies

PHP Build Version
Package Version
Requires agilepixels/laravel-commentable Version ^1.0.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 agilepixels/laravel-rateable contains the following files

Loading the files please wait ....