PHPackages                             yaquawa/laravel-email-reset - 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. yaquawa/laravel-email-reset

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

yaquawa/laravel-email-reset
===========================

Laravel package for email reset.

v1.0.8(6y ago)22.8kMITPHPPHP &gt;=7.1.3

Since Jul 13Pushed 6y ago1 watchersCompare

[ Source](https://github.com/yaquawa/laravel-email-reset)[ Packagist](https://packagist.org/packages/yaquawa/laravel-email-reset)[ Docs](https://github.com/yaquawa/laravel-email-reset)[ RSS](/packages/yaquawa-laravel-email-reset/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (10)Used By (0)

A Laravel package for resetting user email by sending a verification link to the new email.

This package reset the user's email by:

1. Send verification link to user's new email.
2. If the user clicks the verification link in their new email, the package will verify the new email and set the old email to the new one.

How to install
--------------

[](#how-to-install)

To get started, follow the following steps.

#### Installation

[](#installation)

`composer require yaquawa/laravel-email-reset`

#### Configuration

[](#configuration)

Add the following code to your `` file.

```
'defaults' => [
    'guard'       => 'web',
    'passwords'   => 'users',
    'email-reset' => 'default' // Add this line
],

// Add this entire block
'email-reset' => [
    'default' => [
        'table'  => 'email_resets',
        'expire' => 60,
        'callback' => 'App\Http\Controllers\Auth\ResetEmailController@reset',
        // 'ignore-migrations' => true,
        // 'route' => 'email/reset/{token}',
    ]
]
```

#### Migration

[](#migration)

`php artisan migrate`

If you would like to use your own migration, set `ignore-migrations` to `true` in the config file (See the migration file [here](https://github.com/yaquawa/laravel-email-reset/blob/master/database/migrations/2018_06_01_000001_create_email_resets_table.php)).

#### Publish the assets

[](#publish-the-assets)

The following command publishes the package's controller and translation files to your app's directories.

`php artisan vendor:publish --tag=laravel-email-reset`

AssetLocationController`app/Http/Controllers/Auth/ResetEmailController.php`Translations`resources/lang/vendor/laravel-email-reset`#### Use the `CanResetEmail` trait

[](#use-the-canresetemail-trait)

In your `app/Models/User.php` file, use the `CanResetEmail` trait. This trait adds a `resetEmail` method to the user model.

```
namespace App\Models;

use Yaquawa\Laravel\EmailReset\CanResetEmail;

class User extends Authenticatable
{
    use CanResetEmail;
}
```

Usage
-----

[](#usage)

### Send the verification email

[](#send-the-verification-email)

```
// By calling the `resetEmail` method of `User` instance,
// an verification email will be sent to the user's new email address.
// If the user clicked the verification link, the new email address will be set.

// * The route of the verification link can be set at `route` in the config file.

$user->resetEmail('new_email@example.com');
```

If you want to change the email contents, you can do something like this in your `AppServiceProvider.php`.

```
namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Notifications\Messages\MailMessage;
use Yaquawa\Laravel\EmailReset\Notifications\EmailResetNotification;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        EmailResetNotification::toMailUsing(function ($user, $token, $resetLink) {
            return (new MailMessage)
                ->line('You are receiving this email because we received a email reset request for your account.')
                ->action('Reset Email', $resetLink)
                ->line('If you did not request a email reset, no further action is required.');
        });
    }
}
```

After the user clicked the verification link, by default, the user will be redirected to the root of your app URL. You can change this behavior by overriding the methods of the published controller `ResetEmailController`.

```
namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Yaquawa\Laravel\EmailReset\ResetEmail;

class ResetEmailController extends Controller
{
    use ResetEmail;

    /**
     * This method will be called if the token is invalid.
     * Should return a response that representing the token is invalid.
     *
     * @param $status
     *
     * @return mixed
     */
    protected function sendResetFailedResponse(string $status)
    {
        return redirect($this->redirectPathForFailure())->withErrors(['laravel-email-reset' => trans($status)]);
    }

    /**
     * This method will be called if the token is valid.
     * New email will be set for the user.
     * Should return a response that representing the email reset has succeeded.
     *
     * @param $status
     *
     * @return mixed
     */
    protected function sendResetResponse(string $status)
    {
        return redirect($this->redirectPathForSuccess())->with('laravel-email-reset', trans($status));
    }

    /**
     * The redirect path for failure.
     *
     * @return string
     */
    protected function redirectPathForFailure(): string
    {
        return '/';
    }

    /**
     * The redirect path for success.
     *
     * @return string
     */
    protected function redirectPathForSuccess(): string
    {
        return '/';
    }

}
```

### Retrieve the "new email"

[](#retrieve-the-new-email)

The new email won't be saved until the user clicks the verification link. Before user clicking the verification link you can get the new email by:

```
$user->new_email; // retrieve the `new_email` from database
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 80% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~78 days

Recently: every ~155 days

Total

9

Last Release

2239d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d7e8cfe971551433df7557368a24c122907ebdc5c5fc8c18920f1438aaafbffd?d=identicon)[yaquawa](/maintainers/yaquawa)

---

Top Contributors

[![yaquawa](https://avatars.githubusercontent.com/u/13927101?v=4)](https://github.com/yaquawa "yaquawa (12 commits)")[![abenevaut](https://avatars.githubusercontent.com/u/1134021?v=4)](https://github.com/abenevaut "abenevaut (3 commits)")

---

Tags

laravelemail

### Embed Badge

![Health badge](/badges/yaquawa-laravel-email-reset/health.svg)

```
[![Health](https://phpackages.com/badges/yaquawa-laravel-email-reset/health.svg)](https://phpackages.com/packages/yaquawa-laravel-email-reset)
```

###  Alternatives

[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[propaganistas/laravel-disposable-email

Disposable email validator

5762.6M6](/packages/propaganistas-laravel-disposable-email)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
