PHPackages                             coderberg/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. coderberg/google-authenticator

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

coderberg/google-authenticator
==============================

Google Authenticator 2-factor authentication

v1.2.1(3y ago)139.6k↓55%1BSD-4-ClausePHPPHP &gt;=8.0CI failing

Since May 18Pushed 3y agoCompare

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

READMEChangelog (5)Dependencies (4)Versions (6)Used By (1)

Google Authenticator PHP class
==============================

[](#google-authenticator-php-class)

- Copyright (c) 2012-2016,
- Author: Michael Kliewe, [@PHPGangsta](https://twitter.com/PHPGangsta) and [contributors](https://github.com/PHPGangsta/GoogleAuthenticator/graphs/contributors)
- Licensed under the BSD License.

[![PHPUnit](https://github.com/Coderberg/GoogleAuthenticator/actions/workflows/tests.yml/badge.svg)](https://github.com/Coderberg/GoogleAuthenticator/actions/workflows/tests.yml) [![Code Quality](https://github.com/Coderberg/GoogleAuthenticator/actions/workflows/lint.yml/badge.svg)](https://github.com/Coderberg/GoogleAuthenticator/actions/workflows/lint.yml)

This PHP class can be used to interact with the Google Authenticator mobile app for 2-factor-authentication. This class can generate secrets, generate codes, validate codes and present a QR-Code for scanning the secret. It implements TOTP according to [RFC6238](https://tools.ietf.org/html/rfc6238)

For a secure installation you have to make sure that used codes cannot be reused (replay-attack). You also need to limit the number of verifications, to fight against brute-force attacks. For example, you could limit the amount of verifications to 10 tries within 10 minutes for one IP address (or IPv6 block). It depends on your environment.

### Supported PHP Versions

[](#supported-php-versions)

- PHP 8.0
- PHP 8.1
- PHP 8.2

### Installation

[](#installation)

```
composer req coderberg/google-authenticator
```

### Usage

[](#usage)

```
