Events
Voyti dispatches events at key points in the user lifecycle,
allowing your application to react, log, or extend behaviour. Each
event carries a const string name to distinguish
before/after variants. Attach your own listeners through the Yii3
event dispatcher configuration.
Events with default listeners
| Event | Trigger | Default behavior |
|---|---|---|
AfterLoginEvent | User logs in | Triggers password expiration check and session tracking |
AfterRegisterEvent | New user registration | Sends admin notification email |
Additional events (no default listeners)
Dispatched by the library, but nothing consumes them by default - attach your own listener via the event dispatcher configuration if you need to react to them.
- UserEvent - Carries a
getType()discriminator:UserEvent::CREATE,BLOCK,UNBLOCK,CONFIRM,SWITCH_IDENTITY,RESTORE_IDENTITY,PASSWORD_RESET, orDELETE - UserProfileEvent - Dispatched when a user updates their profile
- GdprEvent - Dispatched after a user's account is anonymized (not on hard delete, which fires
UserEventwith typeUserEvent::DELETE) - ResetPasswordEvent - Password reset flow
- SessionEvent - Dispatched with type
SESSION_CREATEDon login, and with typeSESSION_TERMINATEDwhenever a user's sessions are terminated (account deletion, GDPR anonymization, or being blocked). TheSESSION_UPDATEDtype is defined but not currently dispatched.