PHPackages                             hashemi/fireworks - 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. hashemi/fireworks

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

hashemi/fireworks
=================

A simple trait that will help to fire property wise event on your laravel model. Using laravel model events, to create hooks.

1.1(4y ago)1672MITPHPPHP &gt;=7.1

Since Sep 14Pushed 4y ago3 watchersCompare

[ Source](https://github.com/hashemirafsan/fireworks)[ Packagist](https://packagist.org/packages/hashemi/fireworks)[ RSS](/packages/hashemi-fireworks/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

Laravel Fireworks
=================

[](#laravel-fireworks)

A simple trait that will help to fire model property wise event on your laravel model. Using laravel model events, to create hooks with changed column and data.

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

[](#installation)

You can start it from composer. Go to your terminal and run this command from your project root directory.

```
composer require hashemi/fireworks
```

Setup
-----

[](#setup)

At first, you need to use `Fireworks` trait on your model where you want register your model events.

```
class User extends Model
{
    // Use Fireworks Trait
    // ....
    use \Hashemi\Fireworks\Fireworks;
    // ....
}
```

`Fireworks` trait add `boot` method on your model and register pre-defined model event hooks that already provided by laravel. This package supports `retrieved, creating, created, updating, updated, deleting, deleted, saving, saved` hooks. So, you don't need to register again this hooks are on `boot` method.

How to use
----------

[](#how-to-use)

This package will help you figure out of every hooks in methods. Example: suppose you want to use `creating` hooks, just declare `onModelCreating` method on your model.

```
class User extends Model
{
    // Use Fireworks Trait
    // ....
    use \Hashemi\Fireworks\Fireworks;
    protected $fillable = [
        'name',
    ];
    // ....
    protected function onModelCreating($model) {
        $model->name = "Kuddus";
    }

    protected function onModelUpdating($model) {}

    protected function onModelSaving($model) {}

    protected function onModelCreated($model) {}

    protected function onModelUpdated($model) {}

    protected function onModelSaved($model) {
        $model->name = "Ali";
        $model->save();
    }

    protected function onModelNameSaved($model, $newValue, $oldValue)
    {

    }
}
```

#### onModelCreating($model)

[](#onmodelcreatingmodel)

You can use `onModelCreating` instead of `static::creating`

#### onModelUpdating($model)

[](#onmodelupdatingmodel)

You can use `onModelUpdating` instead of `static::updating`

#### onModelSaving($model)

[](#onmodelsavingmodel)

You can use `onModelSaving` instead of `static::saving`

#### onModelDeleting($model)

[](#onmodeldeletingmodel)

You can use `onModelDeleting` instead of `static::creating`

#### onModelRetrieved($model)

[](#onmodelretrievedmodel)

You can use `onModelRetrieved` instead of `static::creating`

#### onModelCreated($model)

[](#onmodelcreatedmodel)

You can use `onModelCreated` instead of `static::created`

#### onModelUpdated($model)

[](#onmodelupdatedmodel)

You can use `onModelUpdated` instead of `static::updated`

#### onModelSaved($model)

[](#onmodelsavedmodel)

You can use `onModelSaved` instead of `static::saved`

#### onModelDeleted($model)

[](#onmodeldeletedmodel)

You can use `onModelDeleted` instead of `static::deleted`

Convention
----------

[](#convention)

- Your hooks method should be `onModel*` format. Where the `*` will be replaced by the StudlyCase Hooks names. So, if your hook is `creating`, then the method name should be `onModelCreating()`.
- If you want to fire event on column change wise then your hook method should be `onModel`. Where the `PropertyName` will be replaced with your column name in StudlyCase and `Hookname` will be also same way. So if your column is `phone_number` and your hook is `updating`, then the method name should be `onModelPhoneNumberUpdating()`.

Warning
-------

[](#warning)

Please use hooks proper way other way data will modified in each hook.

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

[](#contributing)

Pull requests are welcome. For any changes, please open an issue first to discuss what you would like to change.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~569 days

Total

2

Last Release

1502d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/22c4489646c60d47047d71ea2e26e39e7a3ab6cc864499fd99b21d582ccac9c9?d=identicon)[hashemi](/maintainers/hashemi)

---

Top Contributors

[![hashemirafsan](https://avatars.githubusercontent.com/u/16275582?v=4)](https://github.com/hashemirafsan "hashemirafsan (8 commits)")

---

Tags

column-wise-eventseloquentlaravelmodel-eventslaraveleloquentmodel eventscolumn-wise-events

### Embed Badge

![Health badge](/badges/hashemi-fireworks/health.svg)

```
[![Health](https://phpackages.com/badges/hashemi-fireworks/health.svg)](https://phpackages.com/packages/hashemi-fireworks)
```

###  Alternatives

[cviebrock/eloquent-sluggable

Easy creation of slugs for your Eloquent models in Laravel

4.0k13.6M253](/packages/cviebrock-eloquent-sluggable)[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[watson/validating

Eloquent model validating trait.

9723.3M47](/packages/watson-validating)[cybercog/laravel-ban

Laravel Ban simplify blocking and banning Eloquent models.

1.1k651.8k11](/packages/cybercog-laravel-ban)[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k302.7k1](/packages/cybercog-laravel-love)[cviebrock/eloquent-taggable

Easy ability to tag your Eloquent models in Laravel.

567694.8k3](/packages/cviebrock-eloquent-taggable)

PHPackages © 2026

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