spatie/laravel-welcome-notification
Send welcome emails to new Laravel users with a secure, expiring link to set their initial password. Adds migrations and a trait for your User model, plus a controller you extend to show the welcome form and save the password.
sendWelcomeNotification), it could be extended to integrate with Laravel’s event system (e.g., Registered event) for better decoupling.Notifiable trait, mail/driver support). Minimal boilerplate required.WelcomeNotification class extends Laravel’s Notification), allowing for branding or additional content.users table with email and password fields.expiresAt logic (e.g., time zones, daylight saving).shouldQueue() or a queue worker.ResetPassword notification. Clarify use case upfront.Authenticatable), notifications (Notification), and mail systems.composer require spatie/laravel-welcome-notification
php artisan vendor:publish --provider="Spatie\WelcomeNotification\WelcomeNotificationServiceProvider"
WelcomeNotification class (if extending) for branding/content.$user->sendWelcomeNotification(now()->addDay());
Registered event (recommended for decoupling):
use Spatie\WelcomeNotification\Events\UserRegistered;
UserRegistered::listen(function ($user) {
$user->sendWelcomeNotification(now()->addDay());
});
sendWelcomeNotification method and link expiry logic.composer.json for exact versions). Ensure compatibility with your Laravel version.users table with email and password fields. Works with MySQL, PostgreSQL, SQLite, etc.WelcomeNotification class or config will require local maintenance.shouldQueue()) for scalability.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Notification delivery fails | User doesn’t receive welcome email | Use shouldQueue() + queue monitoring |
| Link expiry logic flawed | Security risk (stale links) | Test with clock manipulation; use Carbon |
| Race conditions in registration | Duplicate notifications | Idempotent design (e.g., check for existing links) |
| Database issues | Link validation fails | Ensure users table is accessible |
| Third-party driver failures | SMS/mail failures | Fallback to alternative channels |
WelcomeNotification class) for future maintainers.How can I help you explore Laravel packages today?