PHPackages                             huaweichenai/google-authenticator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. huaweichenai/google-authenticator

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

huaweichenai/google-authenticator
=================================

基于Google Authenticator双因素身份验证实现动态码验证

1.0(1y ago)080BSD-4-ClausePHPPHP &gt;=5.5

Since Dec 19Pushed 1y ago1 watchersCompare

[ Source](https://github.com/huaweichenai/google-authenticator)[ Packagist](https://packagist.org/packages/huaweichenai/google-authenticator)[ RSS](/packages/huaweichenai-google-authenticator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

基于Google Authenticator双因素身份验证实现动态码验证
====================================

[](#基于google-authenticator双因素身份验证实现动态码验证)

Installation

-------------

[](#installation)

```
composer require huaweichenai/google-authenticator

```

Usage:
------

[](#usage)

- 1：创建密钥

```
$authenticator = new Authenticator();
$secret = $authenticator->createSecret();
```

- 2：获取手机端扫描二维码链接(用于手机端获取动态口令)

```
$authenticator = new Authenticator();
$qrCodeUrl  = $authenticator->getQRCodeGoogleUrl('username', $secret, 'title');
```

不支持使用此方法，此方法向第三方分享了你的安全性，建议使用下面的方法获取二维码信息自行生成二维码

- 3：获取手机端扫描二维码的信息（使用此信息生成二维码用于手机端获取动态口令）

```
$authenticator = new Authenticator();
$authCode  = $authenticator->getAuthCode('username', $secret, 'title');
```

- 4：动态口令认证

```
$authenticator = new Authenticator();
$verifyCode  = $authenticator->verifyCode($secret, 'code验证码');
if (verifyCode) {
  echo '认证成功';
} else {
  echo '认证失败';
}
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

515d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2b421da4ccc357acb51b3c127387bf06648210f5fb68fcec8ad831859b474d1a?d=identicon)[huaweichenai](/maintainers/huaweichenai)

---

Tags

authenticatorgoogleauthenticator

### Embed Badge

![Health badge](/badges/huaweichenai-google-authenticator/health.svg)

```
[![Health](https://phpackages.com/badges/huaweichenai-google-authenticator/health.svg)](https://phpackages.com/packages/huaweichenai-google-authenticator)
```

###  Alternatives

[robthree/twofactorauth

Two Factor Authentication

1.2k10.5M66](/packages/robthree-twofactorauth)[enygma/gauth

PHP library to generate codes compatible with the Google Authenticator clients

75129.0k1](/packages/enygma-gauth)[2amigos/2fa-library

2 Factor Authentication (2FA) library

34367.1k7](/packages/2amigos-2fa-library)[chillerlan/php-authenticator

A generator for counter- and time based 2-factor authentication codes (Google Authenticator). PHP 8.2+

58119.1k2](/packages/chillerlan-php-authenticator)[foglcz/ldap-authenticator

LDAP Authenticator plugin for Nette Framework

137.2k](/packages/foglcz-ldap-authenticator)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
