2017 © Pedro Peláez
 

library gauth

PHP library to generate codes compatible with the Google Authenticator clients

image

enygma/gauth

PHP library to generate codes compatible with the Google Authenticator clients

  • Tuesday, November 14, 2017
  • by enygma
  • Repository
  • 7 Watchers
  • 75 Stars
  • 66,698 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 11 Forks
  • 2 Open issues
  • 7 Versions
  • 3 % Grown

The README.md

Total Downloads, (*1)

The GAuth library is designed to generate and validate codes compatible with the Google Authenticator tools., (*2)

Installation via Composer:

Include in your composer.json file:, (*3)

{
    "require": {
        "enygma/gauth": "dev-master"
    }
}

Getting Started

To get started using the Google Authenticator with your application, you'll need to make an initialization key (using generateCode) and save that to your app's settings. This is the code you'll share with your users when they're trying to set up their client for your system., (*4)

Then, when they log in you have them enter in the latest code listed for your application for thier account., (*5)

NOTE: This tool offers a "window of opportunity" for the codes of 2 seconds forward and backward of the current timestamp, just in case things are a bit off. You can change this with the setRange method:, (*6)

setRange(3);
?>

To generate a new code:

generateCode();
var_dump($code);

?>

To validate a code

validateCode($code);

if ($verify == true) {
    echo 'User code verified!';
} else {
    echo 'User code invalid!';
}
?>

To get the QR code for the application

You can also use the tool to get the URL for a QR code users can scan to add your application to their Authenticator client. The call to generateQrImage returns the actual image data for you to use as you wish, either to embed in an img tag or save to a file:, (*7)

generateQrImage($holder, $name, 200);

// To use in an image tag:
echo '

'; // Or just save to a file file_put_contents('/path/to/qr-file.png', $qrCodeImageData); ?>

The library uses internal QR code generation, not the Google Charts API many similar libraries use., (*8)

More info:

The Versions

14/11 2017

dev-downgrade-compat

dev-downgrade-compat https://github.com/enygma/gauth.git

PHP library to generate codes compatible with the Google Authenticator clients

  Sources   Download

MIT

The Requires

 

google authenticator twofactor codes

12/09 2016

dev-master

9999999-dev https://github.com/enygma/gauth.git

PHP library to generate codes compatible with the Google Authenticator clients

  Sources   Download

MIT

The Requires

 

google authenticator twofactor codes

12/09 2016

0.4

0.4.0.0 https://github.com/enygma/gauth.git

PHP library to generate codes compatible with the Google Authenticator clients

  Sources   Download

MIT

The Requires

 

google authenticator twofactor codes

01/12 2015

0.3

0.3.0.0 https://github.com/enygma/gauth.git

PHP library to generate codes compatible with the Google Authenticator clients

  Sources   Download

MIT

The Requires

 

google authenticator twofactor codes

24/11 2015

0.2.1

0.2.1.0 https://github.com/enygma/gauth.git

PHP library to generate codes compatible with the Google Authenticator clients

  Sources   Download

MIT

The Requires

 

google authenticator twofactor codes

23/11 2015

0.2

0.2.0.0 https://github.com/enygma/gauth.git

PHP library to generate codes compatible with the Google Authenticator clients

  Sources   Download

MIT

The Requires

 

google authenticator twofactor codes

10/09 2015

0.1

0.1.0.0 https://github.com/enygma/gauth.git

PHP library to generate codes compatible with the Google Authenticator clients

  Sources   Download

MIT

The Requires

 

google authenticator twofactor codes