protonemedia/laravel-verify-new-email
A Laravel package for secure email changes: when users update their email, a verification link is sent to the new address and the account is only updated after confirmation, helping prevent typos, unauthorized changes, and account takeover.
Architecture fit: Strong for a conventional Laravel monolith using Eloquent, Laravel auth guards, notifications, and a standard users table. The package targets a real gap in Laravel’s built-in verification flow: preserving the current email until a proposed new email is verified. It is a poor fit for non-Laravel services, custom identity providers, or apps with a separate account/email model unless wrapped behind application-owned interfaces.
Integration feasibility: Likely low-to-medium effort: Composer install, publish/configure migrations and config, apply the package trait to the user model, expose verification routes, customize the notification, and change the profile-update controller so it writes a pending email rather than overwriting email. The main integration work is not package installation; it is UX, auth-flow, and edge-case handling around the pending state.
Technical risk: Moderate but bounded. The package is MIT, recently released, and narrow in scope, which limits blast radius and makes replacement feasible. However, 412 stars with 0 dependents signals limited ecosystem validation, and a small package may carry maintainer/version-matrix risk. Security-sensitive areas to verify: signed URL/token lifetime, single-use behavior, rate limiting, email enumeration, notification queueing, and interaction with Laravel’s existing MustVerifyEmail flow.
Key questions:
Stack fit: Best fit is a Laravel app with server-rendered auth/profile pages and a single User model. For SPA/API architectures, the package can still own persistence and verification logic, but the team must expose explicit endpoints and pending-email state to the frontend. For multi-tenant apps, confirm tenant scoping on pending-email lookups and verification routes.
Migration path: Treat this as a feature slice, not a platform migration. Add the package and schema change behind a feature flag, apply the trait, wire routes and notification templates, then update the profile-change flow to store a pending address while leaving the active email untouched. Add UI states for “verification pending,” resend, cancel, and expiry. Do not backfill existing users; the pending column should remain null until a change is requested.
Compatibility: Validate against the app’s Laravel/PHP version, auth guard configuration, notification channels, queue driver, and existing verification middleware. Confirm whether the app already uses signed URLs or custom email-change logic that could collide. Check localization and branding requirements for the verification email. Confirm behavior with case-insensitive email storage and unique constraints.
Sequencing: Start with a short technical spike and threat model, then implement in a branch with acceptance tests for update, verify, expire, resend, duplicate, and rollback paths. Run a pilot cohort before broad release. Keep a fallback path to disable the feature flag and restore direct email updates if verification delivery fails. The package should be leveraged for token/notification mechanics; the application should retain ownership of rate limiting, audit logging, UX copy, and support tooling.
Maintenance: Low code-maintenance burden if version constraints are healthy, but the team still owns Composer updates, Laravel upgrade compatibility, notification template changes, and translation upkeep. Because dependents are low, assign an owner to monitor upstream releases and be prepared to fork or replace the small surface area.
Support: Expect user-confusion tickets around “why is my old email still active?” and “I didn’t get the verification email.” Provide resend/cancel flows, clear UI messaging, and a support runbook for stale pending emails. Add audit events for email-change requests, verification success, expiry, and cancellation.
Scaling: Runtime and storage overhead are negligible: typically one pending-email field plus token/signature handling and one notification per request. The real scaling concern is email deliverability and queue throughput, not the package logic. Apply rate limits to change and resend actions to prevent abuse and notification storms.
Failure modes: Expired or lost verification links, typo’d new addresses, undelivered notifications, duplicate pending-email attempts, race conditions between concurrent changes, and stale pending records. Security failure modes include replayable links, enumeration through verification responses, and compromised old-email accounts remaining active longer than expected. Define cleanup for expired pending changes and monitoring for verification completion rate, bounce rate, and support volume.
Ramp-up: Developer ramp-up is low; product/UX and QA/security ramp-up is moderate because the feature changes account identity behavior. Before rollout, agree on acceptance criteria, rollback steps, support scripts, and success metrics such as verification completion time, resend rate, and email-change-related tickets.
How can I help you explore Laravel packages today?