/php-mfa

PHP implementation of Multi-Factor Authentication (MFA)

Primary LanguagePHPMIT LicenseMIT

Latest Version on Packagist Build Status Quality Score Total Downloads

Installation

You can install the package via composer:

composer require arnissolle/php-mfa

Supported third party Authenticator app

Google Microsoft LastPass Authy

Usage

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, 'jdoe@domain.tld', 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);

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email pierre@arnissolle.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

PHP Package Boilerplate

This package was generated using the PHP Package Boilerplate.