PHPackages                             enygma/gauth - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. enygma/gauth

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

enygma/gauth
============

PHP library to generate codes compatible with the Google Authenticator clients

0.4(9y ago)75129.0k↓26.1%10[1 issues](https://github.com/enygma/gauth/issues)[1 PRs](https://github.com/enygma/gauth/pulls)1MITPHPPHP &gt;=5.3.1

Since Sep 10Pushed 8y ago7 watchersCompare

[ Source](https://github.com/enygma/gauth)[ Packagist](https://packagist.org/packages/enygma/gauth)[ Docs](https://github.com/enygma/gauth.git)[ RSS](/packages/enygma-gauth/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (7)Used By (1)

GAuth : Google Authenticator Code Generator/Validation
======================================================

[](#gauth--google-authenticator-code-generatorvalidation)

[![Total Downloads](https://camo.githubusercontent.com/3e1aa76ce0a9ee7db0d6d64dfaa70b04fb412896448a15b62d62686bfa9651fc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656e79676d612f67617574682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/enygma/gauth)

The `GAuth` library is designed to generate and validate codes compatible with the Google Authenticator tools.

### Installation via Composer:

[](#installation-via-composer)

Include in your `composer.json` file:

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

```

#### Getting Started

[](#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.

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

**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:

```

```

#### To generate a new code:

[](#to-generate-a-new-code)

```

```

#### To validate a code

[](#to-validate-a-code)

```
