PHPackages                             spomky-labs/otphp - 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. spomky-labs/otphp

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

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

11.5.0(3w ago)1.5k50.3M↓17.8%160[6 PRs](https://github.com/Spomky-Labs/otphp/pulls)20MITPHPPHP &gt;=8.1CI passing

Since Feb 24Pushed 3d ago38 watchersCompare

[ Source](https://github.com/Spomky-Labs/otphp)[ Packagist](https://packagist.org/packages/spomky-labs/otphp)[ Docs](https://github.com/Spomky-Labs/otphp)[ GitHub Sponsors](https://github.com/Spomky)[ Patreon](https://www.patreon.com/FlorentMorselli)[ RSS](/packages/spomky-labs-otphp/feed)WikiDiscussions 11.6.x Synced 2d ago

READMEChangelog (10)Dependencies (16)Versions (87)Used By (20)Security (2)

TOTP / HOTP library in PHP
==========================

[](#totp--hotp-library-in-php)

[![Build Status](https://github.com/spomky-labs/otphp/actions/workflows/ci.yml/badge.svg)](https://github.com/spomky-labs/otphp/actions/workflows/ci.yml)

[![Latest Stable Version](https://camo.githubusercontent.com/0abc5aa690f59a45e225b6251f2ad928620a41e3822d6efffaada9a9a74b0c92/68747470733a2f2f706f7365722e707567782e6f72672f73706f6d6b792d6c6162732f6f747068702f762f737461626c652e737667)](https://packagist.org/packages/spomky-labs/otphp)[![Total Downloads](https://camo.githubusercontent.com/a5d084e5460edbc6f6f4e959c8c1ec9fe9cf95d341b02e2b8a934aed3b0e7d17/68747470733a2f2f706f7365722e707567782e6f72672f73706f6d6b792d6c6162732f6f747068702f646f776e6c6f6164732e737667)](https://packagist.org/packages/spomky-labs/otphp)[![Latest Unstable Version](https://camo.githubusercontent.com/de0a6050d7b3625fcf96cf01fd6db4edc40d694c9c491424c5dc2bb6cdb2d4ce/68747470733a2f2f706f7365722e707567782e6f72672f73706f6d6b792d6c6162732f6f747068702f762f756e737461626c652e737667)](https://packagist.org/packages/spomky-labs/otphp)[![License](https://camo.githubusercontent.com/f8db1257d1d1c1d31a7560580d47026d8e48827c66dc9cebd449c1c5406ac790/68747470733a2f2f706f7365722e707567782e6f72672f73706f6d6b792d6c6162732f6f747068702f6c6963656e73652e737667)](https://packagist.org/packages/spomky-labs/otphp)

A php library for generating one-time passwords according to [RFC 4226](https://datatracker.ietf.org/doc/html/rfc4226) (HOTP Algorithm) and [RFC 6238](https://datatracker.ietf.org/doc/html/rfc6238) (TOTP Algorithm)

This library is compatible with Google Authenticator apps available for Android and iPhone. It is also compatible with other applications such as [FreeOTP](https://play.google.com/store/apps/details?id=org.fedorahosted.freeotp) for example.

Documentation
=============

[](#documentation)

The documentation of this project is available in the [*doc* folder](doc/index.md).

Support
=======

[](#support)

I bring solutions to your problems and answer your questions.

If you really love that project, and the work I have done or if you want I prioritize your issues, then you can help me out for a couple of 🍻 or more!

[Become a sponsor](https://github.com/sponsors/Spomky)

Or

[![Become a Patreon](https://camo.githubusercontent.com/ef7b855018f1f680eeba6fd1ac470b9c1971ef883b2f4b9fcf41034274510e3f/68747470733a2f2f63352e70617472656f6e2e636f6d2f65787465726e616c2f6c6f676f2f6265636f6d655f615f706174726f6e5f627574746f6e2e706e67)](https://www.patreon.com/FlorentMorselli)

Contributing
------------

[](#contributing)

Requests for new features, bug fixes and all other ideas to make this project useful are welcome.

Please report all issues in [the repository bug tracker](https://github.com/Spomky-Labs/otphp/issues).

Also make sure to [follow these best practices](.github/CONTRIBUTING.md).

Licence
-------

[](#licence)

This software is release under the [MIT licence](LICENSE).

###  Health Score

81

—

ExcellentBetter than 100% of packages

Maintenance97

Actively maintained with recent releases

Popularity77

Solid adoption and visibility

Community51

Growing community involvement

Maturity87

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 75.1% 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 ~62 days

Recently: every ~2 days

Total

73

Last Release

26d ago

Major Versions

v8.3.1 → v9.0.22017-07-24

v8.3.2 → v9.0.32017-11-23

v8.3.x-dev → v9.1.12018-10-26

v9.0.x-dev → v10.0.02019-07-30

v10.0.x-dev → v11.0.02022-06-24

PHP version history (9 changes)v1.0.0-stablePHP &gt;=5.3.2

v6.0.0PHP &gt;=5.6

v6.0.3PHP &gt;=5.5.9

v7.0.3PHP &gt;=5.5

v8.0.0PHP ^5.5|^7.0

v9.0.0-alpha1PHP ^7.1

v10.0.0PHP ^7.2|^8.0

v11.0.0PHP ^8.1

11.3.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/ccc6c59de7d9ddc53219653bc58f1e082ef83d96632d233eedc0b7097cf80ea3?d=identicon)[Spomky](/maintainers/Spomky)

---

Top Contributors

[![Spomky](https://avatars.githubusercontent.com/u/1091072?v=4)](https://github.com/Spomky "Spomky (211 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (30 commits)")[![Slamdunk](https://avatars.githubusercontent.com/u/152236?v=4)](https://github.com/Slamdunk "Slamdunk (8 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (4 commits)")[![anthonyryan1](https://avatars.githubusercontent.com/u/543852?v=4)](https://github.com/anthonyryan1 "anthonyryan1 (2 commits)")[![fefas](https://avatars.githubusercontent.com/u/6557756?v=4)](https://github.com/fefas "fefas (2 commits)")[![exussum12](https://avatars.githubusercontent.com/u/1102850?v=4)](https://github.com/exussum12 "exussum12 (2 commits)")[![vinkla](https://avatars.githubusercontent.com/u/499192?v=4)](https://github.com/vinkla "vinkla (2 commits)")[![noplanman](https://avatars.githubusercontent.com/u/9423417?v=4)](https://github.com/noplanman "noplanman (2 commits)")[![kix](https://avatars.githubusercontent.com/u/345754?v=4)](https://github.com/kix "kix (1 commits)")[![kw-pr](https://avatars.githubusercontent.com/u/9133572?v=4)](https://github.com/kw-pr "kw-pr (1 commits)")[![leandro-lugaresi](https://avatars.githubusercontent.com/u/858713?v=4)](https://github.com/leandro-lugaresi "leandro-lugaresi (1 commits)")[![pkly](https://avatars.githubusercontent.com/u/17160364?v=4)](https://github.com/pkly "pkly (1 commits)")[![reedy](https://avatars.githubusercontent.com/u/67615?v=4)](https://github.com/reedy "reedy (1 commits)")[![ssx](https://avatars.githubusercontent.com/u/254889?v=4)](https://github.com/ssx "ssx (1 commits)")[![tomme87](https://avatars.githubusercontent.com/u/9094256?v=4)](https://github.com/tomme87 "tomme87 (1 commits)")[![yookoala](https://avatars.githubusercontent.com/u/91274?v=4)](https://github.com/yookoala "yookoala (1 commits)")[![Aadeesh11](https://avatars.githubusercontent.com/u/66922161?v=4)](https://github.com/Aadeesh11 "Aadeesh11 (1 commits)")[![ziegenberg](https://avatars.githubusercontent.com/u/856916?v=4)](https://github.com/ziegenberg "ziegenberg (1 commits)")[![Chris53897](https://avatars.githubusercontent.com/u/7104259?v=4)](https://github.com/Chris53897 "Chris53897 (1 commits)")

---

Tags

hotpotpphprfc-4226rfc-6238rfc4226rfc6238totpgoogle authenticatorotphotptotpRFC 6238RFC 4226FreeOTP

### Embed Badge

![Health badge](/badges/spomky-labs-otphp/health.svg)

```
[![Health](https://phpackages.com/badges/spomky-labs-otphp/health.svg)](https://phpackages.com/packages/spomky-labs-otphp)
```

###  Alternatives

[web-auth/webauthn-lib

FIDO2/Webauthn Support For PHP

12310.5M135](/packages/web-auth-webauthn-lib)[web-auth/webauthn-framework

FIDO2/Webauthn library for PHP and Symfony Bundle.

515100.5k3](/packages/web-auth-webauthn-framework)[pedrosancao/php-otp

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

1872.5k](/packages/pedrosancao-php-otp)[christian-riesen/otp

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

885.5M6](/packages/christian-riesen-otp)[chillerlan/php-authenticator

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

58133.8k3](/packages/chillerlan-php-authenticator)[infocyph/otp

Simple &amp; Secure Generic OTP, OCRA (RFC6287), TOTP (RFC6238) &amp; HOTP (RFC4226) solution!

147.3k](/packages/infocyph-otp)

PHPackages © 2026

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