elison / laravel_google_2fa
A Package for 2fa google authentication in Laravel Framework
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/elison/laravel_google_2fa
This package is auto-updated.
Last update: 2025-10-25 17:13:18 UTC
README
Package for 2fa Google authentication in Laravel Framework
Installation
composer require elison/laravel_google_2fa
Add the provider in the app.php
config/app.php
\Elison\GoogleAuthenticator\GoogleAuthenticatorProvider::class
Add table that stores the secret keys
php artisan migrate
Methods available
1. GoogleAuthenticator::generateQrCodeUrl($applicationName, $width, $height, $level) -> This method generates the QR Code which user needs to scan with Google Authenticator, and returns the secret key and qr code url
2. GoogleAuthenticator::setCredentials($userId, $secretKey) -> This method stores the secret key for the user that will be used later on, it may be used when the user has finished with code scanning
3. GoogleAuthenticator::checkIfTwoFaIsActive($userId) -> This method checks if the 2fa is active for the user, can be used to not display qr code again for an already authenticated user.
4. GoogleAuthenticator::verifyIfCodeIsValid($userId, $code) -> This method verifies if the code that the authenticated user enters is valid.