This Laravel package provides a simple solution for email verification.
This Laravel package provides a simple solution for email verification., (*1)
, (*2)
, (*3)
, (*4)
, (*5)
It is recommended to install this package in a fresh installation of Laravel., (*6)
This package is integrated with Laravel's built-in Auth System, so you must first run this command if you have not run it yet:, (*7)
php artisan make:auth
Now go to your (env) file and make sure that you have selected your database., (*8)
Now install the package using composer by running the following command:, (*9)
composer require aliabdulaziz/laravel-email-verification
Go to: (Your Laravel App) --> config --> app.php, (*10)
and add the following line under 'Package Service Providers' comment:, (*11)
Aliabdulaziz\LaravelExtendedUser\LaravelEmailVerificationServiceProvider::class
Run the following command to publish the package config file:, (*12)
php artisan vendor:publish --provider="Aliabdulaziz\LaravelEmailVerification\LaravelEmailVerificationServiceProvider" --tag=config
The config file is named (laravelemailverification.php) and will be located in the 'config' folder., (*13)
Run the artisan migrate command to create the users table:, (*14)
this command will also migrate the package migration file by which the email_verification field is added to the users table., (*15)
php artisan migrate
go to your (env) file and make sure that you have configured your mail driver., (*16)
Go to: (Your Laravel App) --> app --> Http --> Kernal.php, (*17)
and add the following middleware to the $routeMiddleware array:, (*18)
'verifyEmail' => \Aliabdulaziz\LaravelEmailVerification\Middleware\VerifyEmail::class,
Now you can use this middleware on the routes that you want to prevent from being accessed by the users who did not verify their emails., (*19)
Route::middleware(['web', 'auth', 'verifyEmail'])->group(function () { // Only users with verified emails can access this route Route::get('verified-email', function () { echo "Your email is verified!"; }); });
To customize the package default views publish them to your views folder by running the following command:, (*20)
php artisan vendor:publish --provider="Aliabdulaziz\LaravelEmailVerification\LaravelEmailVerificationServiceProvider" --tag=views
Now make whatever customization you want on the published views., (*21)