PHPackages                             milenmk/laravel-email-change-confirmation - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. milenmk/laravel-email-change-confirmation

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

milenmk/laravel-email-change-confirmation
=========================================

A Laravel package for secure email change confirmation with support for both traditional controllers and Livewire components

1.2.1(8mo ago)227MITPHPPHP ^8.2|^8.3|^8.4

Since Aug 14Pushed 8mo agoCompare

[ Source](https://github.com/milenmk/laravel-email-change-confirmation)[ Packagist](https://packagist.org/packages/milenmk/laravel-email-change-confirmation)[ RSS](/packages/milenmk-laravel-email-change-confirmation/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (2)Dependencies (13)Versions (4)Used By (0)

Laravel Email Change Confirmation
=================================

[](#laravel-email-change-confirmation)

[![Latest Version on Packagist](https://camo.githubusercontent.com/6bd2cd049df9972f802baf581b8827a12327d916200c2747d78a7bdf01b6b789/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d696c656e6d6b2f6c61726176656c2d656d61696c2d6368616e67652d636f6e6669726d6174696f6e2e7376673f7374796c653d666c6174)](https://packagist.org/packages/milenmk/laravel-email-change-confirmation)[![Total Downloads](https://camo.githubusercontent.com/eafaf47f2800580839b3de0432f675c797410127dfb184af30c961c5eb6fc80d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d696c656e6d6b2f6c61726176656c2d656d61696c2d6368616e67652d636f6e6669726d6174696f6e2e7376673f7374796c653d666c6174)](https://packagist.org/packages/milenmk/laravel-email-change-confirmation)[![GitHub User's stars](https://camo.githubusercontent.com/81aa96b9ce8bf27eaf58a9d81ff9f9c46ceea3849dbaf8a3f9ca6604abb29244/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6d696c656e6d6b2f6c61726176656c2d656d61696c2d6368616e67652d636f6e6669726d6174696f6e)](https://github.com/milenmk/laravel-email-change-confirmation)[![Laravel 10 Support](https://camo.githubusercontent.com/0b7f902482de7d3663b7aa6b87b7caca6e7b3fed489112e6f65f79f4514e60de/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31302e7825374331312e7825374331322e782d6f72616e67653f7374796c653d666c6174266c6f676f3d6c61726176656c)](https://laravel.com/docs)[![PHP Version Support](https://camo.githubusercontent.com/63677fb10ff13174dc459b76f666b9a18a55115de97b7dded4ceb5fa51da3f41/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6d696c656e6d6b2f6c61726176656c2d656d61696c2d6368616e67652d636f6e6669726d6174696f6e3f7374796c653d666c6174)](https://www.php.net)[![License](https://camo.githubusercontent.com/cfedbed8586624631b3ce85c6ff88d9f8cd63acf9b938ed8b75b1114b4620edb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d696c656e6d6b2f6c61726176656c2d656d61696c2d6368616e67652d636f6e6669726d6174696f6e2e7376673f7374796c653d666c6174)](https://github.com/milenmk/laravel-email-change-confirmation/blob/develop/LICENSE.md)[![Contributions Welcome](https://camo.githubusercontent.com/9e93e892d0685e1bf7a1d0bd7c8410d6ecf2086a0a7b48dd58a6b96fa556ea2a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f6e747269627574696f6e732d77656c636f6d652d627269676874677265656e2e7376673f7374796c653d666c6174)](https://github.com/milenmk/laravel-email-change-confirmation/issues)[![Sponsor me](https://camo.githubusercontent.com/2aff1b5ae52a46452f3284b52645e299f456561d4dfd9b4d20d0a00a8351a123/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53706f6e736f722d2545322539442541342d6666363962343f7374796c653d666c6174)](https://www.patreon.com/c/LaravelAddonsbyMilen)

A Laravel package that provides secure email change confirmation functionality. When users attempt to change their email address, they must confirm the change via their current email address before the change takes effect.

Features
--------

[](#features)

- 🔒 **Secure email changes** - Users must confirm via their current email
- 📧 **Automatic email verification** - Integrates with Laravel's email verification
- 🎯 **Framework agnostic** - Works with any Laravel starter kit or custom application
- ⚡ **Livewire support** - Built-in support for Livewire applications
- 🔧 **Highly configurable** - Customize every aspect of the package
- 🎨 **Extensible** - Override controllers, notifications, and services
- 🚀 **Auto-detection** - Automatically detects email changes using model observers
- 📱 **Responsive emails** - Beautiful, mobile-friendly confirmation emails

Installation
------------

[](#installation)

### Requirements

[](#requirements)

- PHP 8.3 or higher
- Laravel 10.0, 11.0, or 12.0
- User model must use the `Notifiable` trait

Install the package via Composer:

```
composer require milenmk/laravel-email-change-confirmation
```

Publish and run the migrations:

```
php artisan vendor:publish --tag="email-change-confirmation-migrations"
php artisan migrate
```

Optionally, publish the configuration file:

```
php artisan vendor:publish --tag="email-change-confirmation-config"
```

Add the `HasEmailChangeConfirmation` trait to your user model

### Security Configuration (Recommended)

[](#security-configuration-recommended)

For enhanced security, add a hash secret to your `.env` file:

```
# Generate a secure 32-byte base64-encoded secret
php -r "echo 'EMAIL_CHANGE_HASH_SECRET=' . base64_encode(random_bytes(32)) . PHP_EOL;"
```

Add the generated line to your `.env` file. This enables HMAC-based hashing instead of plain SHA-256 for better security.

Quick Start
-----------

[](#quick-start)

### 1. Add the Trait to Your User Model

[](#1-add-the-trait-to-your-user-model)

Add the `HasEmailChangeConfirmation` trait to your User model:

```
