Repository navigation
v0.1.1 — A grant change announced as an object
A grant change is dispatched as the object it already is.
// before
event()->dispatch('rbac.granted', $moved);
event()->listen('rbac.granted', fn(GrantsChanged $g) => …);
// now
event()->dispatch($moved);
event()->listen(GrantsChanged::class, fn(GrantsChanged $g) => …);GrantsChanged already says what this is, and naming it a second time as a string is a name that can be misspelled into a listener that never runs and never says so. A host now listens for the class, which an IDE can follow and a rename can carry.
Nothing else about the event changed: same payload, same moment, one dispatch per change as before.
Upgrading
A host listening for 'rbac.granted' stops hearing it. Change the listener to GrantsChanged::class in the same deployment — the two are separate keys and nothing warns you.
Requires naf/framework ^0.2.6, which introduced the object form of dispatch().
49 tests, 71 assertions.