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

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

ramprasadm1986/yii2-google-authenticator
========================================

Yii 2 extension wrapper to google authenticator

1.0.1(4y ago)05.6k↓33.3%MITPHP

Since Jan 3Pushed 4y ago1 watchersCompare

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

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

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

[](#yii2-google-authenticator)

![GitHub tag](https://camo.githubusercontent.com/7d1247b7b4bfc85d8b18aa1b592523976175ca614854258dc82672c59bec7064/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d425344253230332d2d436c617573652d627269676874677265656e2e737667)![GitHub tag](https://camo.githubusercontent.com/f3e6a2ac915776dd17843758e16f41a3c6d548e9f67151dc419e33987395d09d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7461672d76312e302e302d626c75652e737667)![GitHub tag](https://camo.githubusercontent.com/519f37d7eb80e7620796a807613768ca88433e15a83b372739d28b9eb46549a6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f6d706f7365722d796969322d2d657874656e73696f6e2d6f72616e67652e737667)

This PHP class can be used to interact with the Google Authenticator mobile app for 2-factor-authentication. This class can generate secrets, generate codes, validate codes and present a QR-Code for scanning the secret. It implements TOTP according to RFC6238

For a secure installation you have to make sure that used codes cannot be reused (replay-attack). You also need to limit the number of verifications, to fight against brute-force attacks. For example you could limit the amount of verifications to 10 tries within 10 minutes for one IP address (or IPv6 block). It depends on your environment.

Install
-------

[](#install)

`composer require ramprasadm1986/yii2-google-authenticator `

Configuration
-------------

[](#configuration)

```
'authenticator' => [
    'class' => 'ramprasadm1986\Authenticator\GoogleAuthenticator'
]

```

Usage example
-------------

[](#usage-example)

```
$authenticator = \Yii::$app->authenticator;

//Google Authenticator Secret
$secret = $authenticator->secret;

//Google Charts URL for the QR-Code
$authenticator->secret = $secret;
$authenticator->name = 'EXAMPLE';
$qRCodeGoogleUrl = $authenticator ->qRCodeGoogleUrl;

//Code
$code = $authenticator->code;
$authenticator->verifyCode($code); //return bool

```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

1596d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/53647737?v=4)[ramprasad](/maintainers/ramprasad)[@Ramprasad](https://github.com/Ramprasad)

---

Top Contributors

[![ramprasadm1986](https://avatars.githubusercontent.com/u/54374127?v=4)](https://github.com/ramprasadm1986 "ramprasadm1986 (3 commits)")

---

Tags

google authenticatoryii2extensioncompents

### Embed Badge

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

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

###  Alternatives

[kakadu-dev/yii2-jwt-auth

Extension provide JWT auth for Yii2

105.8k](/packages/kakadu-dev-yii2-jwt-auth)

PHPackages © 2026

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