PHPackages                             ericmann/totp - 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. ericmann/totp

ActiveLibrary

ericmann/totp
=============

PHP implementation of the TOTP protocol.

2.0.0(7y ago)690MITPHPPHP &gt;=7.2CI failing

Since Nov 19Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ericmann/totp)[ Packagist](https://packagist.org/packages/ericmann/totp)[ RSS](/packages/ericmann-totp/feed)WikiDiscussions master Synced today

READMEChangelog (7)Dependencies (4)Versions (9)Used By (0)

TOTP [![PHP 7.4+](https://camo.githubusercontent.com/7a27e877bc891e35845b636cda3828b079c8d151cb9aeeaedff20b01763eef74/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d372e342532422d677265656e2e737667)](https://camo.githubusercontent.com/7a27e877bc891e35845b636cda3828b079c8d151cb9aeeaedff20b01763eef74/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d372e342532422d677265656e2e737667) [![Build Status](https://github.com/ericmann/totp/actions/workflows/build.yml/badge.svg)](https://github.com/ericmann/totp/actions/workflows/build.yml) [![PHPStan](https://github.com/ericmann/totp/actions/workflows/analysis.yml/badge.svg)](https://github.com/ericmann/totp/actions/workflows/analysis.yml) [![Coverage Status](https://camo.githubusercontent.com/a1a6db3d3459841eab54d2920df6fa36861f9638c137f79b4112746687c54dc6/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f657269636d616e6e2f746f74702f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/ericmann/totp?branch=master) [![Packagist](https://camo.githubusercontent.com/f1037b36b346335178da0d1dfd77cbaa51b817f8cf74878141f34c974315b911/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f657269636d616e6e2f746f74702e737667)](https://packagist.org/packages/ericmann/totp)
==================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#totp-----)

A PHP library for generating one-time passwords according to [RFC-6238](http://tools.ietf.org/html/rfc6238) for time-based OTP generation.

This library is compatible with Google Authenticator apps available for Android and iPhone.

Quick Start
-----------

[](#quick-start)

Use [Composer](https://getcomposer.org/) to add `ericmann/totp` to your project.

```
require __DIR__ . '/vendor/autoload.php';

// Create a new, random token
$token = new EAMann\TOTP\Key();

// Import a known token
$raw = '...';
$token = EAMann\TOTP\Key::import($raw);

// Validate an OTP against a token
if (EAMann\TOTP\is_valid_auth_code($token, $otp)) {
  // ...
}
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

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

Recently: every ~107 days

Total

6

Last Release

2661d ago

Major Versions

1.2.0 → 2.0.02019-01-26

PHP version history (2 changes)1.0.0PHP &gt;=5.6.3

2.0.0PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/86bb3fa9fcfe57b8d313e527e9e02bde810951b25722b4717b0953a6c8db41b2?d=identicon)[ericmann](/maintainers/ericmann)

---

Top Contributors

[![ericmann](https://avatars.githubusercontent.com/u/605474?v=4)](https://github.com/ericmann "ericmann (9 commits)")

---

Tags

totptotpone-time-password

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/ericmann-totp/health.svg)

```
[![Health](https://phpackages.com/badges/ericmann-totp/health.svg)](https://phpackages.com/packages/ericmann-totp)
```

###  Alternatives

[spomky-labs/otphp

A PHP library for generating one time passwords according to RFC 4226 (HOTP Algorithm) and the RFC 6238 (TOTP Algorithm) and compatible with Google Authenticator

1.5k46.1M118](/packages/spomky-labs-otphp)[christian-riesen/otp

One Time Passwords, hotp and totp according to RFC4226 and RFC6238

885.1M5](/packages/christian-riesen-otp)[paragonie/multi-factor

Vendor-agnostic two-factor authentication library

142195.5k2](/packages/paragonie-multi-factor)[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)[2amigos/2fa-library

2 Factor Authentication (2FA) library

34367.1k7](/packages/2amigos-2fa-library)[pedrosancao/php-otp

PHP implementation of HMAC-based one-time password algorithm according to RFC 4226 and RFC 6238 compatible with Google Authenticator

1863.8k](/packages/pedrosancao-php-otp)

PHPackages © 2026

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