pharaonic / laravel-reacts
Polymorphic emoji reactions for Laravel Eloquent models, with registered types, grouped catalogs, single or multiple mode, and database-enforced uniqueness.
13.0.0
2026-11-14 09:02 UTC
Requires
- php: >=8.3 <8.6
- ext-mbstring: *
- illuminate/contracts: ^13.0
- illuminate/database: ^13.0
- illuminate/support: ^13.0
Requires (Dev)
- laravel/pint: ^1.20
- orchestra/testbench: ^11.0
- pestphp/pest: ^4.0
- phpstan/phpstan: ^2.1.33
- phpunit/phpunit: ^12.5.8
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-develop
- 13.x-dev
- 13.0.0
- 12.x-dev
- 12.0.0
- 11.x-dev
- 11.0.0
- 10.x-dev
- 10.0.0
- 9.x-dev
- 9.0.0
- 8.x-dev
- 8.0.0
- 7.x-dev
- 7.0.0
- 6.x-dev
- 6.0.0
- dev-docs/composer-description-11.x
- dev-docs/composer-description-12.x
- dev-docs/composer-description-10.x
- dev-docs/composer-description-8.x
- dev-docs/composer-description-9.x
- dev-docs/composer-description-6.x
- dev-docs/composer-description-7.x
- dev-fix/connection-name-10.x
- dev-fix/connection-name-11.x
- dev-fix/connection-name-6.x
- dev-fix/connection-name-7.x
- dev-fix/connection-name-8.x
- dev-fix/connection-name-9.x
- dev-fix/policy-resolve-10.x
- dev-fix/policy-resolve-6.x
- dev-fix/policy-resolve-7.x
- dev-fix/policy-resolve-8.x
- dev-fix/policy-resolve-9.x
- dev-fix/shared-code-7.x
- dev-fix/shared-code-8.x
- dev-fix/shared-code-6.x
This package is auto-updated.
Last update: 2026-11-14 09:02:58 UTC
README
Reactions for Eloquent models: configured types, free-form emoji, single or multiple mode.
Installation
composer require pharaonic/laravel-reacts php artisan migrate
The service provider is registered automatically, and migrate creates the reactions table. Publish the configuration to define your own reaction types and groups:
php artisan vendor:publish --tag=reacts-config
Usage
Add CanReact to the model that reacts and HasReactions to the model that receives reactions:
use Illuminate\Foundation\Auth\User as Authenticatable; use Pharaonic\Laravel\Reacts\Concerns\CanReact; class User extends Authenticatable { use CanReact; }
use Illuminate\Database\Eloquent\Model; use Pharaonic\Laravel\Reacts\Concerns\HasReactions; class Post extends Model { use HasReactions; }
use Pharaonic\Laravel\Reacts\Support\ReactionView; $user->react($post, 'like'); // true: added $user->react($post, 'love'); // true: a second type (multiple mode, the default) $user->react($post, 'love'); // false: already there $user->toggleReaction($post, 'like'); // false: removed $user->hasReacted($post, 'love'); // true $user->react($chatMessage, '🚀'); // true: in a group that allows free-form emoji $post->reactionCounts(); // ['love' => 1] ReactionView::for($post, $user)->toArray(); // choices, counts and the viewer's selection, for Blade or JSON
Documentation
Full documentation: Laravel Reacts Documentation.
Support & Security
See SUPPORT.md and SECURITY.md. Contributions are welcome; see CONTRIBUTING.md.
License
MIT. See LICENSE.
