luminar-organization / google-authenticator
Google Authenticator Library for PHP
dev-main
2024-11-10 01:40 UTC
Requires
- php: >=8.2
Requires (Dev)
- phpunit/phpunit: >=11.3.1
This package is auto-updated.
Last update: 2025-04-10 02:40:03 UTC
README
Luminar Google Authenticator is a simple library for 2FA using authenticatorapi.com
Installing
composer require luminar-organization/google-authenticator
Functions
Pairing Devices
$authenticator = new \Luminar\GoogleAuthenticator\Authenticator(); // APP_NAME -> Name of your project // APP_INFO -> Example user email // SECRET_CODE -> Static variable same for every user $authenticator->pair("APP_NAME", "APP_INFO", "SECRET_CODE")
Validating
$authenticator = new \Luminar\GoogleAuthenticator\Authenticator(); // PIN -> Combination of 6 numbers provided by user to verify them self // SECRET_CODE -> Static variable same for every user $authenticator->validate("PIN", "SECRET_CODE")
Testing
To run the tests, ensure you have installed all development requirements:
composer install
After that run all tests:
composer run test
License
Luminar Google Authenticator is licensed under the MIT License. See the LICENSE file for more information