Download the PHP package remotemerge/totp-php without Composer
On this page you can find all versions of the php package remotemerge/totp-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download remotemerge/totp-php
More information about remotemerge/totp-php
Files in remotemerge/totp-php
Package totp-php
Short Description Lightweight, fast, and secure TOTP (2FA) authentication library for PHP — battle tested, dependency free, and ready for enterprise integration.
License MIT
Homepage https://github.com/remotemerge/totp-php
Informations about the package totp-php
TOTP PHP: The Ultimate 2FA Library for PHP
Table of Contents
# | Title | Description |
---|---|---|
1 | Why TOTP PHP? | Ideal for secure logins, data protection, and enhanced user security. |
2 | Key Features | Secure secret generation, multi-algorithm support, QR codes, customization. |
3 | Get Started | Quick installation via Composer and simple usage examples. |
4 | Basic Usage | Generate secrets, TOTP codes, verify codes, and create QR code URIs. |
5 | Customization | Change hash algorithms, code length, and time slice duration. |
6 | Advanced Usage | Verify codes with discrepancy and generate QR code images. |
7 | Try with Docker | Test locally using Docker for quick setup. |
8 | Try without Docker | Use PHP's built-in server for lightweight local testing. |
9 | Getting Help | Report bugs, get integration help, or collaborate on projects. |
10 | Contribution | Follow coding standards, test code, and submit pull requests. |
11 | Screenshots | Visual demo of the library in action. |
Why Choose TOTP PHP?
Looking for a versatile, secure, and reliable TOTP library for PHP that provides easy 2FA integration? TOTP PHP is your ultimate solution for seamless 2FA implementation. This developer friendly, lightweight, and secure library offers unmatched simplicity, performance, and customization, making it perfect for secure login systems, data protection, and enhanced user security. Whether you're safeguarding login systems, securing sensitive data, or enhancing user security, TOTP PHP ensures robust protection with exceptional ease of use and high performance, tailored for modern PHP developers.
Key Features
✅ Secure Secret Generation
Generate cryptographically secure secret keys for TOTP, ensuring maximum security for your users.
✅ Multi Algorithm Support
Supports SHA1, SHA256, and SHA512 for HMAC hashing, giving you flexibility and compatibility with all major authenticator apps.
✅ QR Code Integration
Easily generate QR codes for seamless setup in authenticator apps like Google Authenticator, Microsoft Authenticator, Authy, and more.
✅ Customizable Code Length
Generate TOTP codes with 6 or 8 digits, tailored to your application's needs.
✅ Time Slice Configuration
Customize the time slice duration (e.g., 30 or 60 seconds) to match your security requirements.
✅ Discrepancy Verification Allow a time slice discrepancy when verifying TOTP codes, ensuring a smooth user experience. This is especially useful for handling clock drifts.
✅ Easy Verification
Verify TOTP codes with a simple and intuitive API, making integration a breeze.
✅ Lightweight and Fast
Built for performance, TOTP PHP is lightweight and optimized for speed, ensuring minimal overhead.
✅ Developer Friendly
Designed with developers in mind, TOTP PHP is easy to use, well-documented, and fully tested.
Get Started in Minutes
Adding TOTP PHP to your project is quick and easy. THe library requires PHP 8.1 or higher. Here's how to get started:
Installation
Install the library via Composer:
Basic Usage
Generate a Secret Key
Output:
Generate a TOTP Code
Output:
Verify a TOTP Code
Output:
Generate a QR Code URI
Output:
Customization Options
Change the Hash Algorithm
By default, TOTP PHP uses SHA1. You can switch to SHA256 or SHA512:
Change the Code Length
By default, TOTP PHP generates 6-digit codes. You can switch to 8-digit codes:
Change the Time Slice Duration
By default, TOTP PHP uses a 30-second time slice. You can switch to 60 seconds:
Advanced Usage
Verify Code with Discrepancy
Handle clock drift by allowing a discrepancy of ±1 time slice:
Generate a QR Code Image
Use the QR code URI to generate a QR code image:
Try with Docker
Test the TOTP PHP library locally using Docker. This method automatically sets up the environment with all dependencies. Follow these steps:
-
Clone the repository:
-
Start the Docker container:
- Access the application at
http://localhost:8080
.
Try with PHP
For a lightweight setup, use PHP's built-in server. This method is ideal for quick local testing and doesn't require Docker. Follow these steps:
-
Clone the repository:
-
Install dependencies using Composer:
-
Start the PHP built-in server:
- Access the application at
http://localhost:8080
.
Getting Help
Bugs and feature requests are tracked using GitHub issues, and they are prioritized to ensure the library remains reliable and up-to-date.
-
Found a Bug?
If you encounter any issues, please open an issue on GitHub. Every issue is addressed diligently to maintain the library's quality. -
Need Help with Integration?
For assistance integrating TOTP PHP into your application or questions about its features, feel free to reach out. Helping developers build secure and efficient systems is a top priority. - Interested in Collaboration?
If this library impresses you, and you're looking for a skilled PHP developer to join your team or collaborate on a project, let's connect and build something amazing together.
Contribution
The contributions of the Open Source community are highly valued and appreciated. To ensure a smooth and efficient process, please adhere to the following guidelines when submitting code:
- Coding Standards: Ensure that the code adheres to PER Coding Style 2.0 standards.
- Testing: All submitted code must pass relevant tests to maintain the library's reliability.
- Documentation: Proper documentation and clean code practices are essential for maintainability.
- Pull Requests: Please make pull requests to the
main
branch.
Thank you for your support and contributions. Looking forward to reviewing your code and building something amazing together!