Download the PHP package hejunjie/google-authenticator without Composer
On this page you can find all versions of the php package hejunjie/google-authenticator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hejunjie/google-authenticator
More information about hejunjie/google-authenticator
Files in hejunjie/google-authenticator
Package google-authenticator
Short Description 一个用于生成和验证时间基础一次性密码(TOTP)的 PHP 包,支持 Google Authenticator 及类似应用。功能包括密钥生成、二维码创建和 OTP 验证 | A PHP library for generating and verifying Time-Based One-Time Passwords (TOTP). Compatible with Google Authenticator and similar apps, with features like secret generation, QR code creation, and OTP verification.
License MIT
Informations about the package google-authenticator
hejunjie/google-authenticator
A PHP library for generating and verifying Time-Based One-Time Passwords (TOTP). Compatible with Google Authenticator and similar apps, with features like secret generation, QR code creation, and OTP verification.
This project has been parsed by Zread. If you need a quick overview of the project, you can click here to view it:Understand this project
Purpose & Intention
With the increasing demand for security, more and more websites and applications are adopting two-factor authentication (2FA) to protect user accounts. Google Authenticator is one of the most common 2FA applications, using time-based one-time passwords (TOTP) to ensure security.
During the implementation of Google Authenticator, I found that many PHP libraries on the market are feature-rich but relatively complex. These libraries not only support TOTP authentication but often include additional functionalities such as user management and complicated configuration options. For many developers, these features can be too large, and often, we only need to accomplish a few simple tasks:
- Generate a TOTP secret;
- Generate a QR code for the user to scan;
- Verify the code entered by the user.
Therefore, I created the hejunjie/google-authenticator library to provide a lightweight and simple solution. If you just need to quickly implement these basic Google Authenticator features, this library should be a great fit for you.
Installation
Install via Composer:
Usage Instructions
1. Generate a key for the user
Generate a secret for the user, which will be required during verification, so it needs to be saved for the user.
2. Generate a QR code from the key
Used for Google Authenticator QR code scanning
3. Verify if it's valid
🔧 Additional Toolkits (Can be used independently or installed together)
This project was originally extracted from hejunjie/tools. To install all features in one go, feel free to use the all-in-one package:
Alternatively, feel free to install only the modules you need:
hejunjie/utils - A lightweight and practical PHP utility library that offers a collection of commonly used helper functions for files, strings, arrays, and HTTP requests—designed to streamline development and support everyday PHP projects.
hejunjie/cache - A layered caching system built with the decorator pattern. Supports combining memory, file, local, and remote caches to improve hit rates and simplify cache logic.
hejunjie/china-division - Regularly updated dataset of China's administrative divisions with ID-card address parsing. Distributed via Composer and versioned for use in forms, validation, and address-related features
hejunjie/error-log - An error logging component using the Chain of Responsibility pattern. Supports multiple output channels like local files, remote APIs, and console logs—ideal for flexible and scalable logging strategies.
hejunjie/mobile-locator - A mobile number lookup library based on Chinese carrier rules. Identifies carriers and regions, suitable for registration checks, user profiling, and data archiving.
hejunjie/address-parser - An intelligent address parser that extracts name, phone number, ID number, region, and detailed address from unstructured text—perfect for e-commerce, logistics, and CRM systems.
hejunjie/url-signer - A PHP library for generating URLs with encryption and signature protection—useful for secure resource access and tamper-proof links.
hejunjie/google-authenticator - A PHP library for generating and verifying Time-Based One-Time Passwords (TOTP). Compatible with Google Authenticator and similar apps, with features like secret generation, QR code creation, and OTP verification.
hejunjie/simple-rule-engine - A lightweight and flexible PHP rule engine supporting complex conditions and dynamic rule execution—ideal for business logic evaluation and data validation.
👀 All packages follow the principles of being lightweight and practical — designed to save you time and effort. They can be used individually or combined flexibly. Feel free to ⭐ star the project or open an issue anytime!
This library will continue to be updated with more practical features. Suggestions and feedback are always welcome — I’ll prioritize new functionality based on community input to help improve development efficiency together.