Skip to content
This repository has been archived by the owner on Dec 5, 2020. It is now read-only.
/ php-mfa Public archive

PHP implementation of Multi-Factor Authentication (MFA)

License

Notifications You must be signed in to change notification settings

arnissolle/php-mfa

Repository files navigation

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, '[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);

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 [email protected] 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.