PHPackages                             cjmellor/engageify - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. cjmellor/engageify

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

cjmellor/engageify
==================

Easily add engagement features like likes, dislikes, upvotes, and downvotes to your models, paving the way for richer user interactions in your application

v2.0.0(1mo ago)3491MITPHPPHP ^8.3CI failing

Since Oct 7Pushed 2w ago1 watchersCompare

[ Source](https://github.com/cjmellor/engageify)[ Packagist](https://packagist.org/packages/cjmellor/engageify)[ Docs](https://github.com/cjmellor/engageify)[ RSS](/packages/cjmellor-engageify/feed)WikiDiscussions 2.x Synced yesterday

READMEChangelog (4)Dependencies (21)Versions (44)Used By (0)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2362d191a7bd23941446e0aaf4620459a414e516a7f29458bdd4c31076fa652f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636a6d656c6c6f722f656e676167656966793f636f6c6f723d7267622532383536253230313839253230323438253239266c6162656c3d72656c65617365267374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/cjmellor/engageify)[![GitHub Tests Action Status](https://camo.githubusercontent.com/84703db82a9ecb51fa7cd5c0d10ea4a8b8276882a9240865ae1b606e1b632615/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f636a6d656c6c6f722f656e676167656966792f72756e2d706573742e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666f722d7468652d626164676526636f6c6f723d726762253238313334253230323339253230313238253239)](https://github.com/cjmellor/engageify/actions/workflows/run-pest.yml?query=branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/5f7f98937dbbc4d546fbabfa52e3901990f7af41cf797ef76b7f6579688f9756/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636a6d656c6c6f722f656e676167656966792e7376673f636f6c6f723d7267622532383234392532303131352532303232253239267374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/cjmellor/engageify)[![Packagist PHP Version](https://camo.githubusercontent.com/f97ca0714dd3e8a2f2d324fc19791684c95ebdfcc15b17569b46ea6ea5718add/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f636a6d656c6c6f722f656e676167656966792f7068703f636f6c6f723d726762253238313635253230313830253230323532253239266c6f676f3d706870266c6f676f436f6c6f723d726762253238313635253230313830253230323532253239267374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/f97ca0714dd3e8a2f2d324fc19791684c95ebdfcc15b17569b46ea6ea5718add/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f636a6d656c6c6f722f656e676167656966792f7068703f636f6c6f723d726762253238313635253230313830253230323532253239266c6f676f3d706870266c6f676f436f6c6f723d726762253238313635253230313830253230323532253239267374796c653d666f722d7468652d6261646765)[![Laravel Version](https://camo.githubusercontent.com/1e77b5d8028b44985280cdd14b16b7fc1fe05f2487dec76ad043f6f2e1f46e04/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d31322e7825323025374325323031332e782d7267622832333525323036382532303530293f7374796c653d666f722d7468652d6261646765266c6f676f3d6c61726176656c)](https://camo.githubusercontent.com/1e77b5d8028b44985280cdd14b16b7fc1fe05f2487dec76ad043f6f2e1f46e04/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d31322e7825323025374325323031332e782d7267622832333525323036382532303530293f7374796c653d666f722d7468652d6261646765266c6f676f3d6c61726176656c)

Engageify is a Laravel package that allows you to integrate engagement features like user reactions (likes, upvotes) to your models.

[![Engagement Package GitHub Preview-2](https://private-user-images.githubusercontent.com/1848476/273671216-9519571c-43f1-4297-af5a-8390a4dd4b29.jpg?jwt=eyJ0eXAiOiJKV1Q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QW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDcwNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjA3MDRUMDkxMjUyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OWE4NTQ0NWVjZDlmYzY5YjRjZGE2ZmE5MGFhOTc3MmFiOTE1NTlkNjg5MjEyMjc3Y2Q2MjcwZDA0YmY4ZmQwZCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmcmVzcG9uc2UtY29udGVudC10eXBlPWltYWdlJTJGanBlZyJ9.LPVBoFG_ypGgPs8hhh_97qQEyLjeuXsqLzGQIxpSG3g)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require cjmellor/engageify
```

Publish and run the migrations. This creates the `engagements`, `engagement_counters`, and `view_buckets` tables the package needs:

```
php artisan vendor:publish --tag="engageify-migrations"
php artisan migrate
```

Publish the config file (optional)

```
php artisan vendor:publish --tag="engageify-config"
```

The published config file allows you to customize table names, model relationships, and more.

Upgrading from v1
-----------------

[](#upgrading-from-v1)

v2 changes how engagement counts are stored and read. **If you are upgrading an existing v1 install, run these steps once — otherwise your counts and scores will read as `0`.**

1. **Publish and run the new migrations.** v2 adds a `value` column to `engagements` and introduces the denormalised `engagement_counters` table (plus the opt-in `view_buckets` table):

    ```
    php artisan vendor:publish --tag="engageify-migrations"
    php artisan migrate
    ```
2. **Backfill the counters (required).** Counts and scores are now read from `engagement_counters`, which starts **empty**. Rebuild it from your existing `engagements` rows:

    ```
    php artisan engageify:recount
    ```

    Until you run this, every count, score, and ranking query returns **`0`** for pre-existing engagements. The engagement rows themselves are untouched — only the counter table needs building.

> **Heads-up:** the in-memory cache layer from v1 has been removed. Counts are kept in step inside the same database transaction as every engage/disengage, so they are always fresh — the `allow_caching` / `cache_duration` config keys no longer exist, and there is nothing to invalidate.

v2 also raises the minimum requirements to **PHP 8.3** and **Laravel 12**, removes the `Engageify` facade, and replaces the five reaction-specific events with two generic ones. If you depended on any of those, see [`UPGRADING.md`](UPGRADING.md) before upgrading.

See [`UPGRADING.md`](UPGRADING.md) for the full checklist.

Usage
-----

[](#usage)

For Models you wish to have engagement features (likes/upvotes), use the `HasEngagements` trait.

```
