Download the PHP package digikraaft/laravel-review-rating without Composer

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

Add Review and Rating Feature to your Laravel application

tests Build Status Scrutinizer Code Quality Code Intelligence Status License: MIT

Review and Rating System for Laravel

This package provides a simple review and rating system for Laravel. It supports Laravel 5.8 an up. Here is a quick demonstration of how it can be used:

Installation

You can install the package via composer:

You must publish the migration with:

Run the migration to publish the reviews table with:

You can optionally publish the config-file with:

The content of the file that will be published to config/review-rating.php:

Usage

Add the HasReviewRating trait to the model:

Create a review

To create a review, use the review function of the trait. Like this:

The first argument is the content of the review while the second argument is the author. This can be any Eloquent model.

To create a review with rating, pass in the rating value as the third argument of the review function. Valid values are ints and floats:

To create a review with rating and title, add the title as the fourth argument of the review function:

You can also check if user has reviewed the model by using the hasReviewed function:

Retrieving reviews

You can get the last review like this:

The content of the review can be gotten like this:

To get the rating for the review, do this:

To get the title of the review:

All reviews can be retrieved like this:

To access each review from the reviews retrieved, do this:

The allReviews scope can be used to retrieve all the reviews for all instances of a model:

Retrieving basic Review Stats

You can get the number of reviews a model has:

To get the number of reviews a model has received over a period, pass in a Carbon formatted $from and $to dates as the first and second arguments respectively:

Note that an InvalidDate exception will be thrown if the $from date is later than the $to

You can get the number of ratings a model has:

To get the number of ratings a model has received over a period, pass in a Carbon formatted $from and $to dates as the first and second arguments respectively:

To get the average rating a model has received:

The average rating that is returned is by default not rounded. If you would like to round the returned result, pass an integer value of the decimal place you want it rounded to.

To get the average rating a model has received over a period, pass in a Carbon formatted $from and $to dates as the first and second arguments respectively:

The withRatings scope can be used to retrieve all the reviews that have a rating for all instances of a model:

Check if model has review

You can check if a model has at least one review:

Check if model has rating

You can check if a model has at least one rating:

Events

The Digikraaft\ReviewRating\Events\ReviewCreatedEvent event will be dispatched when a review has been created. You can listen to this event and take necessary actions. An instance of the review will be passed to the event class and can be accessed for use:

Custom model and migration

You can change the model used by specifying a different class name in the review_model key of the review-rating config file.

You can also change the column name used in the reviews table (default is model_id) when using a custom migration. If this is the case, also change the model_primary_key_attribute key of the review-rating config file.

Testing

Use the command below to run your tests:

More Good Stuff

Check here for more awesome free stuff!

Changelog

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

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

License

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


All versions of laravel-review-rating with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
laravel/framework Version ^10.0|^11.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 digikraaft/laravel-review-rating contains the following files

Loading the files please wait ....