Downloads
Stars
Version
This Laravel package provides a simple solution for email verification.
It is recommended to install this package in a fresh installation of Laravel.
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:
php artisan make:auth
Now go to your (env) file and make sure that you have selected your database.
Now install the package using composer by running the following command:
composer require aliabdulaziz/laravel-email-verification
Go to: (Your Laravel App) --> config --> app.php
and add the following line under 'Package Service Providers' comment:
Aliabdulaziz\LaravelExtendedUser\LaravelEmailVerificationServiceProvider::class
Run the following command to publish the package config file:
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.
Run the artisan migrate command to create the users table:
this command will also migrate the package migration file by which the email_verification field is added to the users table.
php artisan migrate
go to your (env) file and make sure that you have configured your mail driver.
Go to: (Your Laravel App) --> app --> Http --> Kernal.php
and add the following middleware to the $routeMiddleware array:
'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.
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:
php artisan vendor:publish --provider="Aliabdulaziz\LaravelEmailVerification\LaravelEmailVerificationServiceProvider" --tag=views
Now make whatever customization you want on the published views.