This package provides a robust two-factor authentication (2FA) solution for Laravel applications using Google Authenticator.
Install the package via Composer:
composer require hennest/two-factor
Publish the configuration file:
php artisan vendor:publish --tag=two-factor-config
This will create a config/two-factor.php
file. Adjust the settings as needed.
Publish and run the migrations:
php artisan vendor:publish --tag=two-factor-migrations
php artisan migrate
- Add the
HasTwoFactorAuthentication
trait to your User model:
use Hennest\TwoFactor\Traits\HasTwoFactorAuthentication;
class User extends Authenticatable
{
use HasTwoFactorAuthentication;
// ...
}
Publish the views to customize them:
php artisan vendor:publish --tag=two-factor-views
Publish the language files to customize messages:
php artisan vendor:publish --tag=two-factor-lang
Please see CONTRIBUTING.md for details.
The MIT License (MIT). Please see License File for more information.
Contributions are welcome! Please feel free to submit a Pull Request.
This library is open-sourced software licensed under the MIT license.