You can install the package via composer:
composer require arnissolle/php-mfa
Microsoft | LastPass | Authy | |
---|---|---|---|
✅ | ✅ | ❓ | ❓ |
use Arnissolle\MFA\OTP\Auth;
use Arnissolle\MFA\OTP\Code;
use Arnissolle\MFA\OTP\Secret;
// Create new secret
$secret = Secret::create();
// Get the OTP auth URI
$authUri = Auth::uri($secret, '[email protected]', function(Auth $auth) {
$auth->issuer = 'Company Name';
});
// Get the QR Code
// Then scan it with app like Google Authenticator
$qrCodeUrl = Auth::qrCodeUrl($authUri);
// Get code (or use third party app)
$code = Code::get($secret);
// Verify code (bool)
$verify = Code::verify($secret, $code);
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
This package was generated using the PHP Package Boilerplate.