Voyti

Voyti

User management, authentication & authorization

Events

Voyti dispatches events at key points in the user lifecycle, allowing your application to react, log, or extend behaviour. Attach your own listeners through the Yii3 event dispatcher configuration.

EventTriggerDefault behavior
YiiRocks\Voyti\Event\Auth\AfterLoginEventUser logs inTriggers password expiration check and session tracking
YiiRocks\Voyti\Event\Auth\AfterRegisterEventNew user registrationSends admin notification email

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.

EventDescription
YiiRocks\Voyti\Event\User\UserEventCarries a getType() discriminator: CREATE, BLOCK, UNBLOCK, CONFIRM, SWITCH_IDENTITY, RESTORE_IDENTITY, PASSWORD_RESET, or DELETE
YiiRocks\Voyti\Event\User\UserProfileEventDispatched when a user updates their profile (cosmetic fields such as name, phone, avatar)
YiiRocks\Voyti\Event\User\ResetPasswordEventPassword reset flow
YiiRocks\Voyti\Event\Session\SessionEventDispatched with type SESSION_CREATED on login, and with type SESSION_TERMINATED whenever a user’s sessions are terminated (account deletion, being blocked, admin revocation, or logout).

A small set of events are dispatched before the action they precede takes effect. A listener can throw YiiRocks\Voyti\Exception\ActionPreventedException to stop the action; the dispatching service or controller catches it and turns it into a form error or failure result, using the exception’s getErrorDetails() (a list of field/attribute names) when present.

EventTiming and payload
YiiRocks\Voyti\Event\Auth\BeforeLoginEventFired after all login preconditions pass but before the session is established. Carries the about-to-log-in User and server params.
YiiRocks\Voyti\Event\Auth\BeforeRegisterEventFired after the validated form data is hydrated into a User but before it is persisted. Carries the validated form data and the hydrated (not yet saved) User.
YiiRocks\Voyti\Event\User\BeforeAccountUpdateEventFired before account-level fields (username, email, password) are saved. Carries the User and the list of field names about to change.

Emitted around the login and registration forms, and on account-level changes, for analytics, security monitoring, and paired-event flows.

EventDescription
YiiRocks\Voyti\Event\Auth\BeforeLoginFormValidationEventFired once the login form is populated from the request but before it is validated. Carries the raw submitted form data and server params.
YiiRocks\Voyti\Event\Auth\LoginFormValidationFailedEventFired when the login form fails validation. Carries the form data, validation errors, and server params.
YiiRocks\Voyti\Event\Auth\FailedLoginEventFired whenever a login attempt fails, whether at form validation ('validation_failed') or post-validation ('user_not_found', 'invalid_password', 'account_blocked'). Carries the submitted login identifier and server params. Useful for brute-force detection and security monitoring.
YiiRocks\Voyti\Event\Auth\LogoutEventFired when a user intentionally logs out. Carries the User and the terminated session id, letting listeners distinguish an intentional logout from passive session termination.
YiiRocks\Voyti\Event\Auth\BeforeRegisterFormValidationEventFired once the registration form is populated from the request but before it is validated. Carries the raw submitted form data and server params.
YiiRocks\Voyti\Event\Auth\RegisterFormValidationFailedEventFired when the registration form fails validation. Carries the form data, validation errors, and server params.
YiiRocks\Voyti\Event\User\AfterAccountUpdateEventFired after account-level fields (username, email, password) are saved. Carries the updated User and the list of field names that changed. Distinct from UserProfileEvent, which covers cosmetic profile fields.