ericmann / totp
PHP implementation of the TOTP protocol.
2.0.0
2019-01-26 05:49 UTC
Requires
- php: >=7.2
- paragonie/constant_time_encoding: ^1.0.0
Requires (Dev)
- php-coveralls/php-coveralls: ^2.1
- phpunit/phpunit: ^7.5
- squizlabs/php_codesniffer: ^3.4
This package is auto-updated.
Last update: 2024-06-29 03:20:03 UTC
README
TOTP
![Packagist](https://camo.githubusercontent.com/a8badb4bb39576082a075e34776f72e52e43bd203f0137b0923cd6c9f0d9039c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f657269636d616e6e2f746f74702e737667)
A PHP library for generating one-time passwords according to RFC-6238 for time-based OTP generation.
This library is compatible with Google Authenticator apps available for Android and iPhone.
Quick Start
Use Composer 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)) { // ... }