edvinaskrucas / laravel-user-email-verification
Laravel Package for easier user email verification.
Installs: 8 624
Dependents: 0
Suggesters: 0
Security: 0
Stars: 57
Watchers: 5
Forks: 14
Open Issues: 5
Requires
- php: ^5.5|^7.0
- illuminate/console: ^5.2
- illuminate/database: ^5.2
- illuminate/filesystem: ^5.2
- illuminate/http: ^5.2
- illuminate/mail: ^5.2
- illuminate/support: ^5.2
Requires (Dev)
- laravel/framework: ^5.2
- mockery/mockery: 0.9.*
- phpunit/phpunit: ^4.8
This package is auto-updated.
Last update: 2024-12-11 14:26:56 UTC
README
Installation
Require this package in your composer.json by typing in your console:
composer require edvinaskrucas/laravel-user-email-verification
Registering to use it with laravel
Add following lines to app/config/app.php
ServiceProvider array
Krucas\LaravelUserEmailVerification\UserEmailVerificationServiceProvider::class,
Publishing config file
If you want to edit default config file, just publish it to your app folder.
php artisan vendor:publish --provider="Krucas\LaravelUserEmailVerification\UserEmailVerificationServiceProvider" --tag="config"
Publishing translations
In order to customise translations you need to publish it.
php artisan vendor:publish --provider="Krucas\LaravelUserEmailVerification\UserEmailVerificationServiceProvider" --tag="translations"
Publishing views
Package comes with default views, if you want to edit them, just publish it.
php artisan vendor:publish --provider="Krucas\LaravelUserEmailVerification\UserEmailVerificationServiceProvider" --tag="views"
Usage
Configuration
Package comes with several configuration options.
Install default controller, routes and migrations
php artisan verification:make
Command above will add default VerifyController
to app/Http/Controllers/Auth/VerifyController.php
which
will provide default verification behaviour.
Also routes will be modified, it will add default routes for verification controller.
Migrations will add extra columns to users
table to identify if user is verified or not, also
token table will be added to store verification tokens.
After running command you have to install new migrations, this can be done with this command:
php artisan migrate
After all these steps you need to adjust default auth controller provided by Laravel, these adjustments will enable authentication controller to send verification email and will not allow non-verified users to login.
Clear expired tokens
Package comes with useful command to clear expired tokens, just replace {broker}
with your broker name.
php artisan verification:clear-tokens {broker}
More info can be found here: http://www.krucas.com/2016/04/user-email-verification-for-laravel-5/