Installation
Require the package, then publish and run the migration. The service provider and the Likes facade alias are auto-discovered — no manual registration:
composer require roundly-consulting/likes-for-laravel
php artisan vendor:publish --tag="likes-migrations"
php artisan migrateThe migration is publish-only — it is never loaded automatically. Publishing it first keeps the schema in your own database/migrations, where you can review or adjust it before it runs. Publishing again lands on the same file instead of adding a second, differently timestamped copy.
Publish the config first when you change the schema
The migration reads likes.table and likes.key_type when it runs. If your models use UUID or ULID keys, or you want a different table name, publish the config (or set the env vars) before you migrate:
php artisan vendor:publish --tag="likes-config"
# set LIKES_TABLE / LIKES_KEY_TYPE now — the migration reads them when it runs
php artisan vendor:publish --tag="likes-migrations"
php artisan migrateOtherwise the config file is optional — publish it only to override defaults:
php artisan vendor:publish --tag="likes-config"The only publish tags the package exposes are likes-migrations and likes-config. Once installed, php artisan about lists the configured reactions, the default reaction and whether broadcasting is on; a broken reaction setting shows as INVALID.
Next steps
- Add HasLikes to models that can be liked and GivesLikes to models that give likes.
- Wire a like button to Likes::toggle() — or $user->toggleLike() on the model.
- Enable typed reactions in config/likes.php when you need more than a plain like.
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.