PHPackages                             leandrolugaresi/google-authenticator - 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. leandrolugaresi/google-authenticator

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

leandrolugaresi/google-authenticator
====================================

PHP repository for Google Authenticator

1.0.1(11y ago)968.1k↓11.4%3[2 issues](https://github.com/leandro-lugaresi/google-authenticator/issues)GPL-3.0PHPPHP &gt;=5.3.3

Since Sep 19Pushed 8y ago1 watchersCompare

[ Source](https://github.com/leandro-lugaresi/google-authenticator)[ Packagist](https://packagist.org/packages/leandrolugaresi/google-authenticator)[ Docs](https://github.com/leandro-lugaresi/google-authenticator)[ RSS](/packages/leandrolugaresi-google-authenticator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

google-authenticator
====================

[](#google-authenticator)

> \[DEPRECATED\] use the [antonioribeiro/google2fa](https://github.com/antonioribeiro/google2fa) instead!

[![Latest Stable Version](https://camo.githubusercontent.com/1f178c3873e70eb9ee2fcab48233fddac677764251f9597a380749f5a11a2368/68747470733a2f2f706f7365722e707567782e6f72672f6c65616e64726f6c756761726573692f676f6f676c652d61757468656e74696361746f722f762f737461626c652e737667)](https://packagist.org/packages/leandrolugaresi/google-authenticator) [![Total Downloads](https://camo.githubusercontent.com/67dba5a4f6b7de95dd5e2fc27e36bab9fb2719813d8a88b5c47f79ebdcf17e5d/68747470733a2f2f706f7365722e707567782e6f72672f6c65616e64726f6c756761726573692f676f6f676c652d61757468656e74696361746f722f646f776e6c6f6164732e737667)](https://packagist.org/packages/leandrolugaresi/google-authenticator) [![Latest Unstable Version](https://camo.githubusercontent.com/b5c3ce6c75693c26fe1ccffbb81dcb90c51bb9167565154b514365b751b85091/68747470733a2f2f706f7365722e707567782e6f72672f6c65616e64726f6c756761726573692f676f6f676c652d61757468656e74696361746f722f762f756e737461626c652e737667)](https://packagist.org/packages/leandrolugaresi/google-authenticator) [![License](https://camo.githubusercontent.com/d10e5d54b22b79f8f115e3476b102c96fb5f99abc77f9f8cba463625d7dd1a7b/68747470733a2f2f706f7365722e707567782e6f72672f6c65616e64726f6c756761726573692f676f6f676c652d61757468656e74696361746f722f6c6963656e73652e737667)](https://packagist.org/packages/leandrolugaresi/google-authenticator)[ ![Codeship Status for leandro-lugaresi/google-authenticator](https://camo.githubusercontent.com/5b0491ca1974bffa4e247c75051b953f335602793e337052b92cdba6dc2d119c/68747470733a2f2f7777772e636f6465736869702e696f2f70726f6a656374732f63353666303265302d323438392d303133322d656430642d3565386366373135633731632f7374617475733f6272616e63683d6d6173746572)](https://www.codeship.io/projects/36901)

Introduction
------------

[](#introduction)

This is a module to integrate web sites with Google Authenticator.

Requirements
------------

[](#requirements)

- [ChristianRiesen/base32](https://github.com/ChristianRiesen/base32) (1.2)
- [zendframework/zend-math](https://github.com/zendframework/zf2) (&gt;2.2.\*)

Installation
------------

[](#installation)

1. Add this project in your composer.json:

```
    "require": {
        "leandrolugaresi/google-authenticator": "1.0.*"
    }
```

2. Now tell the composer to download the repository by running the command:

```
    $ php composer.phar update
```

Usage
-----

[](#usage)

### Step 1 - Register application

[](#step-1---register-application)

Show the QrCode and the form:

```
    $googleAuth = new \GoogleAuthenticator\GoogleAuthenticator();
    $googleAuth->setIssuer('YourApplicationName');
    //save the secretKey to register after
    $_SESSION['secretKeyTemp'] = $googleAuth->getSecretKey();

    // Show the qrcode to register
    //this param is an identifier of the user in this application
    echo $googleAuth->getQRCodeUrl($user->username.'@YourApplicationName');
```

Verify the code from form and save the secretKey of this user:

```
    $google = new GoogleAuthenticator($_SESSION['secretKeyTemp']);
    $userSubmitCode = $_POST['codeFoo'];
    if ($google->verifyCode($userSubmitCode)) {
        //save the secretKey of this user
    }
```

### Step 2 - Verify Code at login

[](#step-2---verify-code-at-login)

```
    $google = new GoogleAuthenticator($user->getSecretKey());
    $userSubmitCode = $_POST['codeFoo'];

    // Verify Code
    if ($google->verifyCode($userSubmitCode)) {

        // OK - aloowed login
    }
```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~19 days

Total

2

Last Release

4240d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9c40d19209c8d186427cd0e2f82d0fd2a68028a22bb876117541598c4d6f8b7c?d=identicon)[leandro-lugaresi](/maintainers/leandro-lugaresi)

---

Top Contributors

[![leandro-lugaresi](https://avatars.githubusercontent.com/u/858713?v=4)](https://github.com/leandro-lugaresi "leandro-lugaresi (10 commits)")[![soullivaneuh](https://avatars.githubusercontent.com/u/1698357?v=4)](https://github.com/soullivaneuh "soullivaneuh (1 commits)")

---

Tags

googlephp5authenticatorPHP 5

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/leandrolugaresi-google-authenticator/health.svg)

```
[![Health](https://phpackages.com/badges/leandrolugaresi-google-authenticator/health.svg)](https://phpackages.com/packages/leandrolugaresi-google-authenticator)
```

###  Alternatives

[google/auth

Google Auth Library for PHP

1.4k272.7M162](/packages/google-auth)[hwi/oauth-bundle

Support for authenticating users using both OAuth1.0a and OAuth2 in Symfony.

2.4k21.5M69](/packages/hwi-oauth-bundle)[hybridauth/hybridauth

PHP Social Authentication Library

3.4k8.5M94](/packages/hybridauth-hybridauth)[robthree/twofactorauth

Two Factor Authentication

1.2k10.5M66](/packages/robthree-twofactorauth)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

42121.2M118](/packages/league-oauth2-google)[kreait/firebase-tokens

A library to work with Firebase tokens

24040.8M14](/packages/kreait-firebase-tokens)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
