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

Abandoned → [oops/totp-authenticator](/?search=oops%2Ftotp-authenticator)Library[Authentication &amp; Authorization](/categories/authentication)

oops/google-authenticator
=========================

Two-factor authenticator via TOTP algorithm.

2.2.0(6y ago)19217[2 PRs](https://github.com/o2ps/GoogleAuthenticator/pulls)BSD-3-ClausePHPPHP ^7.2

Since Nov 16Pushed 3y ago4 watchersCompare

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

READMEChangelog (1)Dependencies (5)Versions (7)Used By (0)

Oops/TotpAuthenticator
======================

[](#oopstotpauthenticator)

🏚️ THIS PROJECT HAS BEEN ABANDONED
----------------------------------

[](#️-this-project-has-been-abandoned)

Please use  for an up-to-date, more feature-rich implementation of one-time passwords.

---

Oops/TotpAuthenticator implements the [TOTP algorithm](http://tools.ietf.org/html/rfc6238) that lets you easily set up a two-factor authentication mechanism. The TOTP, in short, generates a pseudo-random six-digit number based on current Unix time and given seed (a base32 string of at least 16 characters). The seed is shared between you and mobile app and passed to the app via a QR code. Whenever you need to authenticate the user, ask them to enter the code generated by the application, and verify it against the code generated by your server.

Installation and requirements
-----------------------------

[](#installation-and-requirements)

```
$ composer require oops/totp-authenticator
```

Oops/TotpAuthenticator requires PHP &gt;= 7.2.

Usage
-----

[](#usage)

If you use Nette's DI container, you can easily integrate Oops/TotpAuthenticator with a few lines of configuration:

```
extensions:
	totp: Oops\TotpAuthenticator\DI\TotpAuthenticatorExtension

totp:
	timeWindow: 1
	issuer: MyApp

```

Otherwise, you can directly instantiate `Oops\TotpAuthenticator\Security\TotpAuthenticator` and optionally configure it:

```
$totpAuthenticator = (new Oops\TotpAuthenticator\Security\TotpAuthenticator)
   ->setIssuer('MyApp')
   ->setTimeWindow(1);
```

The `timeWindow` option sets a benevolence that compensates for possible differences between your server's time and the app's time. The default value is 1, which means the code for previous or next 30-second block would be also considered valid. You can set it to zero if you want to be super strict, but I'd strongly recommend not setting it to a higher value than one.

The `issuer` is optional, but is quite useful if you use some generic value as the user's account name, such as their email address. As multiple services can use that same value as a way of identifying the user, you should provide `issuer` to distinguish your app's code in the TOTP app.

### Setting up 2FA

[](#setting-up-2fa)

First, you need to generate a secret - a base32 string - that is shared between you and the application. `TotpAuthenticator` provides a method for that. The secret must be unique to the user and should thus be stored somewhere with other user data, e.g. in the database. Just remember to encrypt it as it is a very sensitive piece of information.

```
$secret = $totpAuthenticator->getRandomSecret();
```

Then, you can display the secret and unique account name (e.g. user's email address) to the user, or, more conveniently, provide them with a QR code containing the URI in a specific format. Again, `TotpAuthenticator` can build the URI for you:

```
$uri = $totpAuthenticator->getTotpUri($secret, $accountName);
```

### Verification

[](#verification)

Once the user has set up the account in their TOTP app, you can ask them to enter the 6-digit code and easily verify it against the secret:

```
if ($totpAuthenticator->verifyCode($code, $secret)) {
	// successfully verified

} else {
	// incorrect code
}
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity62

Established project with proven stability

 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 ~463 days

Total

5

Last Release

2347d ago

Major Versions

1.0 → 2.0.02014-12-03

PHP version history (3 changes)1.0PHP &gt;= 5.4.0

2.1.1PHP &gt;= 7.0.0

2.2.0PHP ^7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/0fa15809b1f4544a0696a3f8e0d9719014242c0f7de639b12919eaedfd213cfe?d=identicon)[jiripudil](/maintainers/jiripudil)

---

Top Contributors

[![jiripudil](https://avatars.githubusercontent.com/u/1042159?v=4)](https://github.com/jiripudil "jiripudil (16 commits)")

---

Tags

hacktoberfestnettephptotptwo-factor-authenticationtotpsecurityAuthentication2fa

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[laragear/two-factor

On-premises 2FA Authentication for out-of-the-box.

339785.3k8](/packages/laragear-two-factor)[jiripudil/otp

Library that generates and verifies one-time passwords.

2825.4k1](/packages/jiripudil-otp)[scheb/2fa-totp

Extends scheb/2fa-bundle with two-factor authentication using TOTP

292.7M22](/packages/scheb-2fa-totp)[chillerlan/php-authenticator

A generator for counter- and time based 2-factor authentication codes (Google Authenticator). PHP 8.2+

58119.1k2](/packages/chillerlan-php-authenticator)[remotemerge/totp-php

Lightweight, fast, and secure TOTP (2FA) authentication library for PHP — battle tested, dependency free, and ready for enterprise integration.

2010.2k](/packages/remotemerge-totp-php)[kelunik/two-factor

Two factor authentication.

371.9k1](/packages/kelunik-two-factor)

PHPackages © 2026

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