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
Requires
- php: >=8.1
- paragonie/constant_time_encoding: ^2.0 || ^3.0
- psr/clock: ^1.0
- symfony/deprecation-contracts: ^3.2
Requires (Dev)
- symfony/error-handler: ^6.4|^7.0|^8.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- 11.6.x-dev
- 11.5.x-dev
- 11.5.1
- 11.5.0
- 11.4.x-dev
- 11.4.4
- 11.4.3
- 11.4.2
- 11.4.1
- 11.4.0
- 11.3.x-dev
- 11.3.0
- 11.2.x-dev
- 11.2.2
- 11.2.1
- 11.2.0
- 11.1.x-dev
- 11.1.1
- 11.1.0
- 11.0.x-dev
- 11.0.3
- v11.0.2
- v11.0.1
- v11.0.0
- v10.0.x-dev
- v10.0.3
- v10.0.2
- v10.0.1
- v10.0.0
- v9.1.4
- v9.1.3
- v9.1.2
- v9.1.1
- v9.1.0
- v9.0.x-dev
- v9.0.3
- v9.0.2
- v9.0.1
- v9.0.0
- v9.0.0-alpha1
- v8.3.x-dev
- v8.3.3
- v8.3.2
- v8.3.1
- v8.3.0
- v8.2.0
- v8.1.0
- v8.0.0
- v7.0.4
- v7.0.3
- v7.0.2
- v7.0.1
- v7.0.0
- v6.0.4
- v6.0.3
- v6.0.2
- v6.0.1
- v6.0.0
- v5.0.1
- 5.0.0
- v4.0.4
- v4.0.3
- v4.0.2
- v4.0.1
- v4.0.0
- v3.1.1
- v3.1.0
- v3.0.1-stable
- v3.0.0-stable
- v2.0.2-stable
- v2.0.1-stable
- v2.0.0-stable
- 1.0.1-stable
- v1.0.0-stable
- dev-11.5.x-merge-up-into-11.6.x_RB8Andre
This package is auto-updated.
Last update: 2026-11-07 19:02:50 UTC
README
TOTP and HOTP one-time passwords.
A php library for generating one-time passwords according to RFC 4226 (HOTP Algorithm) and RFC 6238 (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 for example.
Documentation
The documentation is at https://docs.spomky-labs.com/otphp/, one version per maintained branch.
- Installation — and the PSR-20 clock a TOTP needs.
- TOTP or HOTP? — you almost certainly want TOTP.
- What to store — read this before designing your table.
- Security recommendations — replay, rate limiting, the secret at rest.
- From v11 to v12 — the clock, the setters, and the digests now refused.
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!
Or
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.
Also make sure to follow these best practices.
Licence
This software is release under the MIT licence.