ilbee / totp
Time-based One-Time Password (TOTP) implementation in PHP
2.1.0
2024-04-23 14:47 UTC
Requires
- php: 7.4 || ^8.1
- christian-riesen/base32: ^1.6
- symfony/security-bundle: ^5.4 || ^6.4 || ^7.1
Suggests
- endroid/qr-code-bundle: Enables you to generate TOTP URIs with QR codes
README
This project is a PHP implementation of the TOTP (Time-Based One-Time Password) algorithm. This library is designed to be used with the Symfony framework.
Installation
You can install this library via Composer:
composer require ilbee/totp
Usage
Configuration
You can configure TOTP by passing additional options when creating the instance:
<?php // ./src/Controller/UserController.php use Ilbee\Totp\Totp; $totp = new Totp([ 'digits' => 6, // Number of digits for the one-time password 'period' => 30, // Time period for which a password is valid (in seconds) 'algorithm' => 'sha1', // TOTP Hash algorithm ]);
Contributions
Contributions are welcome. Please open an issue or submit a pull request for any contributions.
Sponsoring
License
This project is licensed under the MIT License. See the LICENSE file for more details.