PHPackages                             rdcstarr/superpower-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. rdcstarr/superpower-events

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

rdcstarr/superpower-events
==========================

Model lifecycle events architecture for Laravel: 6 generic events + 6 listener traits, dispatched automatically via reflection on handleModel().

v0.1.2(1mo ago)01MITPHPPHP ^8.3

Since May 27Pushed 1mo agoCompare

[ Source](https://github.com/rdcstarr/superpower-events)[ Packagist](https://packagist.org/packages/rdcstarr/superpower-events)[ RSS](/packages/rdcstarr-superpower-events/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (3)Dependencies (9)Versions (4)Used By (0)

superpower-events
=================

[](#superpower-events)

Model lifecycle events architecture for Laravel — six generic events (`ModelCreating`/`Created`/`Updating`/`Updated`/`Deleting`/`Deleted`) dispatched automatically by the `DispatchesModelEvents` trait, with companion listener traits that filter by model type via reflection on `handleModel()`.

Install
-------

[](#install)

```
composer require rdcstarr/superpower-events

```

Usage
-----

[](#usage)

### 1. Add the trait to your model

[](#1-add-the-trait-to-your-model)

```
use Rdcstarr\SuperpowerEvents\Concerns\DispatchesModelEvents;

class User extends Model
{
    use DispatchesModelEvents;
}
```

The trait boots automatically via `bootDispatchesModelEvents()` and registers Eloquent hooks for all six lifecycle events.

### 2. Create a listener using a companion trait

[](#2-create-a-listener-using-a-companion-trait)

```
use Rdcstarr\SuperpowerEvents\Concerns\ModelCreated;

class AssignUserUuid
{
    use ModelCreated;

    protected function handleModel(User $user): void
    {
        // Called only for User models — other model types are filtered
        // automatically by reflecting on the parameter type of handleModel().
        $user->uuid = Str::uuid();
        $user->saveQuietly();
    }
}
```

Available listener traits (one per lifecycle hook):

TraitEvent fired`Concerns\ModelCreating`before `INSERT``Concerns\ModelCreated`after `INSERT``Concerns\ModelUpdating`before `UPDATE``Concerns\ModelUpdated`after `UPDATE``Concerns\ModelDeleting`before `DELETE``Concerns\ModelDeleted`after `DELETE`Each trait provides a typed `handle(EventClass $event)` method that filters by the model type declared on your `handleModel()` parameter. No manual `instanceof` check, no `$listen` array — Laravel 11+ auto-discovers the listener from the typed `handle()` signature.

### 3. Pre-save mutations

[](#3-pre-save-mutations)

Pre-save listeners (`ModelCreating` / `ModelUpdating` / `ModelDeleting`) receive the model before the write — mutations applied inside `handleModel()` persist in the same `INSERT`/`UPDATE`:

```
use Rdcstarr\SuperpowerEvents\Concerns\ModelCreating;

class SlugifyPost
{
    use ModelCreating;

    protected function handleModel(Post $post): void
    {
        $post->slug = Str::slug($post->title);
    }
}
```

---

Personal toolkit — no support guarantees.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance88

Actively maintained with recent releases

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

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

Total

3

Last Release

58d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/42062586?v=4)[rdcstarr](/maintainers/rdcstarr)[@rdcstarr](https://github.com/rdcstarr)

---

Top Contributors

[![rdcstarr](https://avatars.githubusercontent.com/u/42062586?v=4)](https://github.com/rdcstarr "rdcstarr (7 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/rdcstarr-superpower-events/health.svg)

```
[![Health](https://phpackages.com/badges/rdcstarr-superpower-events/health.svg)](https://phpackages.com/packages/rdcstarr-superpower-events)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.3M347](/packages/psalm-plugin-laravel)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M136](/packages/laravel-pulse)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M133](/packages/roots-acorn)[flarum/core

Delightfully simple forum software.

211.4M2.4k](/packages/flarum-core)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45444.2k1](/packages/pressbooks-pressbooks)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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