If you want to add an email verification step to user registration in your Laravel Projects, Marcel Pociot has a new package aptly named laravel-confirm-email. New users are required to confirm their registration through an email to proceed.

The package works by providing two traits that replace the AuthenticatesUsers and RegistersUsers that come with Laravel. After registering, users are required to confirm their account via email.

To get started, install the package via Composer:

composer require beyondcode/laravel-confirm-email

This package requires a database migration, which you need to get by running the vendor:publish command:

php artisan vendor:publish --provider=BeyondCodeEmailConfirmationEmailConfirmationServiceProvider

You’ll also need to add two new routes to handle the confirmations, and the package also comes with a language file that you can tweak as well as a configurable notification class used (if you publish the config):


return [
    | Notification
    | This is the notification class that will be sent to users when they receive
    | a confirmation code.
    'notification' => BeyondCodeEmailConfirmationNotificationsConfirmEmail::class,

Learn more about this package by checking out the Official GitHub repository and follow the readme for complete installation and usage instructions.

Sumber: Laravel Blog