Laravel Verify Emails
, (*1)
This package allows you to verify account emails in Laravel using the same pattern as password resets., (*2)
DEPRECATED: Email verification was implemented in the Laravel Framework for the release of 5.7 - if you're using 5.7 or above this package is unnecessary and if you're using a release below 5.6 it's no longer officially supported and you shouldn't be. This package will no longer be maintained., (*3)
Installation
This package is installable with Composer via Packagist., (*4)
Configuration
Add the following to config/auth.php:, (*5)
'verify_emails' => [
'users' => [
'provider' => 'users',
'email' => 'auth.emails.verify',
'table' => 'email_tokens',
'expire' => 60,
],
],
Change the passwords.users.table setting to email_tokens too, allowing password reset and email verification tokens to use the same table. Alternatively, create a new table for the email verification tokens using the same definitions as your password resets table and configure the above accordingly., (*6)
Usage
Implement the LaravelVerifyEmails\Contracts\Auth\CanVerifyEmail contract in your App\User model and use the LaravelVerifyEmails\Auth\VerifyEmails\CanVerifyEmail trait to include the necessary methods. By default, a boolean column on your users table named verified is expected. This behaviour can be altered by overriding the methods in the trait., (*7)
Add the LaravelVerifyEmails\Auth\VerifyEmails\VerifyEmailServiceProvider::class service provider to the providers array in config/app.php., (*8)
Run php artisan make:verify-emails to generate views, routes and a controller. Alternatively, use the LaravelVerifyEmails\Foundation\Auth\VerifiesEmails trait in a controller of your choice., (*9)
Finally, call $user->unverify() to mark the user as unverified and send a verification token to their email address. To catch unverified users, replace the auth route middleware in App\Http\Kernel with \LaravelVerifyEmails\Auth\Middleware\AuthenticateAndVerifyEmail::class. If you'd rather use your own middleware, or want to check if a user is verified elsewhere, call $user->isVerified()., (*10)
Licence
Laravel Verify Email is open-sourced software licensed under the MIT license., (*11)