PHPackages                             binary-cats/fireable-attribute-events - 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. [Database &amp; ORM](/categories/database)
4. /
5. binary-cats/fireable-attribute-events

ActiveLibrary[Database &amp; ORM](/categories/database)

binary-cats/fireable-attribute-events
=====================================

Observe and trigger events based on attributes changes

1.4.0(2mo ago)045[1 PRs](https://github.com/binary-cats/fireable-attribute-events/pulls)MITPHPPHP ^8.2CI passing

Since Feb 10Pushed 1w ago1 watchersCompare

[ Source](https://github.com/binary-cats/fireable-attribute-events)[ Packagist](https://packagist.org/packages/binary-cats/fireable-attribute-events)[ Docs](https://github.com/binary-cats)[ RSS](/packages/binary-cats-fireable-attribute-events/feed)WikiDiscussions main Synced today

READMEChangelog (5)Dependencies (36)Versions (7)Used By (0)

[![](https://camo.githubusercontent.com/97ca08c26bae45f1c06196316ca402ac5e59aec771f3e7788af39d64a0198264/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4669726561626c652532304174747269627574652532304576656e74732e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d62696e6172792d636174732532466669726561626c652d6174747269627574652d6576656e7473267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d4f6273657276652b616e642b747269676765722b6576656e74732b62617365642b6f6e2b6368616e6765732b746f2b796f75722b456c6f7175656e742b61747472696275746573266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d66697265)](https://camo.githubusercontent.com/97ca08c26bae45f1c06196316ca402ac5e59aec771f3e7788af39d64a0198264/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4669726561626c652532304174747269627574652532304576656e74732e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d62696e6172792d636174732532466669726561626c652d6174747269627574652d6576656e7473267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d4f6273657276652b616e642b747269676765722b6576656e74732b62617365642b6f6e2b6368616e6765732b746f2b796f75722b456c6f7175656e742b61747472696275746573266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d66697265)

Fireable Attribute Events
=========================

[](#fireable-attribute-events)

Observe and trigger events based on Eloquent model attributes changes

---

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

[](#installation)

You can install the package via Composer:

```
composer require binary-cats/fireable-attribute-events
```

Usage
-----

[](#usage)

Add the `FireableAttributes` Trait to Your Model:

In any Eloquent model where you want to fire events on attribute changes, use the `FireableAttributes` trait and define a `fireableAttributes` array:

```
use App\Events\OrderStatusChanged;
use App\Events\OrderMarkedHighPriority;
use App\Events\OrderMarkedUrgent;
use BinaryCats\FireableAttributeEvents\FireableAttributes;
use Illuminate\Database\Eloquent\Model;

class Order extends Model
{
    use FireableAttributes;

    protected array $fireableAttributes = [
        'status' => OrderStatusChanged::class,
        'priority' => [
            'high' => OrderMarkedHighPriority::class,
            'urgent' => \OrderMarkedUrgent::class,
        ],
    ];
}
```

- **Direct mapping**: If status changes, it fires OrderStatusChanged.
- **Value-based mapping**: If priority changes to 'high', it fires OrderMarkedHighPriority; if 'urgent', it fires OrderMarkedUrgent.

Each event should accept the model as a constructor parameter.

Events Fire Automatically When Attributes Change. Once a model using `FireableAttributes` is updated, the package will automatically dispatch the corresponding event:

```
$order = Order::find(1);

$order->update(['status' => 'shipped']); // 🚀 Fires OrderStatusChanged event
$order->update(['priority' => 'urgent']); // 🚀 Fires OrderMarkedUrgent event
```

Testing
-------

[](#testing)

```
vendor/bin/pest
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using issue tracker.

Postcardware
------------

[](#postcardware)

You're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.

Credits
-------

[](#credits)

- [Cyrill Kalita](https://github.com/binary-cats)
- [All Contributors](../../contributors)

Support us
----------

[](#support-us)

[Binary Cats](https://binarycats.dev) is a webdesign agency based in Illinois, US.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance92

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 67.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~106 days

Total

5

Last Release

82d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ebb48367388b4368b14cca42714bb13002d7414d9dc8da19c5490ef65c059719?d=identicon)[cyrill.kalita@gmail.com](/maintainers/cyrill.kalita@gmail.com)

---

Top Contributors

[![cyrillkalita](https://avatars.githubusercontent.com/u/2401848?v=4)](https://github.com/cyrillkalita "cyrillkalita (27 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (7 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (3 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (3 commits)")

---

Tags

laraveleventseloquentobserverbinary-cats

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/binary-cats-fireable-attribute-events/health.svg)

```
[![Health](https://phpackages.com/badges/binary-cats-fireable-attribute-events/health.svg)](https://phpackages.com/packages/binary-cats-fireable-attribute-events)
```

###  Alternatives

[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M100](/packages/dedoc-scramble)[wnx/laravel-backup-restore

A package to restore database backups made with spatie/laravel-backup.

213420.1k2](/packages/wnx-laravel-backup-restore)[lacodix/laravel-model-filter

A Laravel package to filter, search and sort models with ease while fetching from database.

17558.6k](/packages/lacodix-laravel-model-filter)[spatie/laravel-passkeys

Use passkeys in your Laravel app

471890.7k39](/packages/spatie-laravel-passkeys)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
