Installation
Require the package. The service provider is auto-discovered and registers the global Reviews facade alias, and its two Roundly dependencies — Media Library for Laravel and Enums for Laravel — plus the package toolkit are installed automatically:
composer require roundly-consulting/reviews-for-laravel
php artisan vendor:publish --tag="reviews-migrations"
php artisan vendor:publish --tag="media-migrations"
php artisan migratePublish-only migrations
The package loads no migrations of its own, so a bare php artisan migrate creates nothing until you have published them. reviews-migrations publishes the reviews and review_votes tables; media-migrations publishes Media Library’s media table, which stores review photos.
If your authors, subjects or voters use UUID or ULID keys, publish the config and set key_type before you migrate — see Database schema.
Optional publishing
The config file is optional — every key has a sensible, mostly env-backed default. Publish it only to override:
php artisan vendor:publish --tag="reviews-config"Translations (the validation and moderation messages) and the JSON resources (to reshape the API output) publish separately:
# Translations → lang/vendor/reviews
php artisan vendor:publish --tag="reviews-translations"
# JSON resources → app/Http/Resources/Reviews
php artisan vendor:publish --tag="reviews-resources"Cached aggregate columns are opt-in and have their own tag — publish that stub once per reviewable table (see Cached aggregates):
php artisan vendor:publish --tag="reviews-aggregate-migrations"
php artisan migrateThe complete set of publish tags is reviews-config, reviews-migrations, reviews-translations, reviews-resources and reviews-aggregate-migrations.
Next steps
- Add HasReviews to the models people review and CanReview to the models that write reviews.
- Create your first review with Reviews::for($subject)->by($author).
- Decide on moderation: keep the pending queue, auto-approve, or plug in a moderator.
Show your open-source love
This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.
More ways to support, including cryptoBy donating, you agree to our donation terms.
Want this built into your product?
We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.