PHPackages                             kettasoft/booter - 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. [Framework](/categories/framework)
4. /
5. kettasoft/booter

ActiveLibrary[Framework](/categories/framework)

kettasoft/booter
================

The Laravel Model Event Booter package provides a flexible way to organize and manage model event handling in Laravel applications. It allows developers to define specific actions for model events (such as created, updated, deleted, etc.) by associating them with custom classes. The package simplifies the process of executing logic for model events and makes it easy to extend and maintain event-driven behavior.

v1.0.2(1y ago)0191MITPHPPHP &gt;=8.1

Since Oct 1Pushed 1y ago1 watchersCompare

[ Source](https://github.com/kettasoft/booter)[ Packagist](https://packagist.org/packages/kettasoft/booter)[ RSS](/packages/kettasoft-booter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (4)Used By (1)

Laravel Model Event Booter
==========================

[](#laravel-model-event-booter)

**Laravel Model Event Booter** is a package that simplifies managing model events in Laravel by allowing you to define and map model events (e.g., `created`, `updated`, `deleted`, etc.) to custom classes. These classes handle the logic associated with those events, making your code cleaner, modular, and easier to maintain.

[![Sponsor](https://camo.githubusercontent.com/3f9a3c47d5a6c575b4d6c5f13ecaf55ff585c67a6ba47f87f8cf57e4cb7a1fdc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73706f6e736f722d3330333633443f7374796c653d666f722d7468652d6261646765266c6f676f3d4769744875622d53706f6e736f7273266c6f676f436f6c6f723d237768697465)](//github.com/sponsors/kettasoft)[![Latest Stable Version](https://camo.githubusercontent.com/711b9358d2bd5cf294b4d7a4a72a1cb69deda8a88fd1f4697a8f6b096a7da8ca/68747470733a2f2f706f7365722e707567782e6f72672f73616e7469676172636f722f626f6f7465722f763f7374796c653d666f722d7468652d6261646765)](//packagist.org/packages/kettasoft/booter)[![Total Downloads](https://camo.githubusercontent.com/ffe146996e96ccfef7cdb57b1dd9eca2a4e13b492f2f58f09383debd1164d3b9/68747470733a2f2f706f7365722e707567782e6f72672f6b65747461736f66742f626f6f7465722f646f776e6c6f6164733f7374796c653d666f722d7468652d6261646765)](//packagist.org/packages/kettasoft/booter)[![License](https://camo.githubusercontent.com/a7841a39e33d3b6fccfe01af6b2a694f6152bf96f07bfe09fa8442d36e186b72/68747470733a2f2f706f7365722e707567782e6f72672f6b65747461736f66742f626f6f7465722f6c6963656e73653f7374796c653d666f722d7468652d6261646765)](//packagist.org/packages/kettasoft/booter)[![tests](https://github.com/kettasoft/booter/workflows/tests/badge.svg)](https://github.com/kettasoft/booter/actions?query=workflows/tests)

Features
--------

[](#features)

- Automatically boot and trigger model events with custom logic.
- Organize event-specific logic into separate, reusable classes.
- Works with Laravel's built-in model events (`created`, `updated`, `deleted`, etc.).
- Easy-to-use HasBooter trait that handles event firing.

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

[](#installation)

1. - Install the package via Composer:

```
composer require kettasoft/booter

```

2. - Add the `HasBooter` trait to any model where you want to manage events.
3. - Define the `$events` array in the model to map events to the classes that will handle them.
4. - Publish the package's configuration file by running:

```
php artisan vendor:publish --provider="Scaffolding\Booter\Providers\BooterServiceProvider" --tag=config

```

Usage
-----

[](#usage)

1. - Add the `HasBooter` Trait to Your Model
    - Use the `HasBooter` trait in your model to enable event handling:

```
use Scaffolding\Booter\Traits\HasBooter;

class Post extends Model
{
    use HasBooter;

    /**
     * The event-to-class mappings.
     *
     * @var array
     */
    protected static $events = [
        'created' => [
            \App\Boot\AttachAuthorIdBoot::class,
        ],
        'updated' => [
            \App\Boot\LogChangesBoot::class,
        ],
    ];
}
```

2. - Create Event Handler Classes Create a class for each event that you want to handle. Each class should have a handle method where you define the logic to run when the event is triggered.

```
namespace App\Boots;

use Scaffolding\Booter\HasBooter;

class AttachAuthorIdBoot extends HasBooter
{
    /**
     * Handle the model event.
     *
     * @param  \Illuminate\Database\Eloquent\Model $model
     * @return void
     */
    public function handle(\Illuminate\Database\Eloquent\Model $model)
    {
        // Custom logic for 'created' event
        $model->author_id = auth()->id();
        $model->save();
    }
}
```

The class defined in the event will be called automatically when the event occurs.

3. - Handle Multiple Events

You can define multiple events in the $events array for a single model. Each event can have one or more classes that will be triggered in sequence.

```
protected static $events = [
    'created' => [
        \App\Boot\AttachAuthorIdBoot::class,
        \App\Boot\SendNotificationBoot::class,
    ],
    'updated' => [
        \App\Boot\LogChangesBoot::class,
    ],
];
```

4. - Event Handling Flow
    - When the model event (like `created`, `updated`, etc.) is triggered, the package automatically fires the associated class.
    - Each class must have a handle method where you implement the custom logic.

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

[](#contributing)

Contributions are welcome! If you find any issues or have ideas for improvements, feel free to submit a pull request or open an issue.

License
-------

[](#license)

This package is open-source software licensed under the MIT license.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

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 ~1 days

Total

3

Last Release

594d ago

PHP version history (2 changes)v1.0.1PHP ^8.0

v1.0.2PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/514a1d3f5416af98e8f0174f21cd94d357204a98704e92fd37db2903b08e2057?d=identicon)[kettasoft](/maintainers/kettasoft)

---

Top Contributors

[![kettasoft](https://avatars.githubusercontent.com/u/80687771?v=4)](https://github.com/kettasoft "kettasoft (9 commits)")

---

Tags

booterelqouenteventslaravelmodel

### Embed Badge

![Health badge](/badges/kettasoft-booter/health.svg)

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

###  Alternatives

[codewithdennis/larament

Larament is a time-saving starter kit to quickly launch Laravel 13.x projects. It includes FilamentPHP 5.x pre-installed and configured, along with additional tools and features to streamline your development workflow.

3691.5k](/packages/codewithdennis-larament)[ecotone/laravel

Laravel integration for Ecotone

21307.6k3](/packages/ecotone-laravel)

PHPackages © 2026

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