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

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

sonata-project/google-authenticator
===================================

Library to integrate Google Authenticator into a PHP project

2.3.1(5y ago)43211.7M—0.6%12120MITPHPPHP ^7.3 || ^8.0

Since Feb 16Pushed 4y ago17 watchersCompare

[ Source](https://github.com/sonata-project/GoogleAuthenticator)[ Packagist](https://packagist.org/packages/sonata-project/google-authenticator)[ Docs](https://github.com/sonata-project/GoogleAuthenticator)[ GitHub Sponsors](https://github.com/OskarStark)[ GitHub Sponsors](https://github.com/VincentLanglet)[ RSS](/packages/sonata-project-google-authenticator/feed)WikiDiscussions 2.x Synced 1mo ago

READMEChangelog (6)Dependencies (1)Versions (13)Used By (20)

Google Authenticator
====================

[](#google-authenticator)

Ported from

You can use the Google Authenticator app from here [http://www.google.com/support/accounts/bin/answer.py?hl=en&amp;answer=1066447](http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=1066447)to generate One Time Passwords/Tokens and check them with this little PHP app (Of course, you can also create them with this).

[![Latest Stable Version](https://camo.githubusercontent.com/2b9d0f15ea5d8231e7ccd97db5e1e9e1d3a248e8bbf1742c7604173d60914e11/68747470733a2f2f706f7365722e707567782e6f72672f736f6e6174612d70726f6a6563742f676f6f676c652d61757468656e74696361746f722f762f737461626c65)](https://packagist.org/packages/sonata-project/google-authenticator)[![Latest Unstable Version](https://camo.githubusercontent.com/66f040d0b22b86b60df37352037bfe32be5cd65ec4c7ef35fdc3d882178c7bb1/68747470733a2f2f706f7365722e707567782e6f72672f736f6e6174612d70726f6a6563742f676f6f676c652d61757468656e74696361746f722f762f756e737461626c65)](https://packagist.org/packages/sonata-project/google-authenticator)[![License](https://camo.githubusercontent.com/a99497605ae8b0dcc9cafa8169bff9d3b6c64a06bbd9eb0fd2618e1b23b1c90f/68747470733a2f2f706f7365722e707567782e6f72672f736f6e6174612d70726f6a6563742f676f6f676c652d61757468656e74696361746f722f6c6963656e7365)](https://packagist.org/packages/sonata-project/google-authenticator)

[![Total Downloads](https://camo.githubusercontent.com/9dc9fc1ecfceb1c739b7e93d89b6254d9a255f6650ec3be970efdb8a094f52d5/68747470733a2f2f706f7365722e707567782e6f72672f736f6e6174612d70726f6a6563742f676f6f676c652d61757468656e74696361746f722f646f776e6c6f616473)](https://packagist.org/packages/sonata-project/google-authenticator)[![Monthly Downloads](https://camo.githubusercontent.com/6ddeb24ac07f12ccd0b5934c014755f662e0cbb34d06e9bb41cb2d6ee531958d/68747470733a2f2f706f7365722e707567782e6f72672f736f6e6174612d70726f6a6563742f676f6f676c652d61757468656e74696361746f722f642f6d6f6e74686c79)](https://packagist.org/packages/sonata-project/google-authenticator)[![Daily Downloads](https://camo.githubusercontent.com/e055567489d6c0342f7bf314b5f37073965ca02168b5100a35d50c803c28b7c7/68747470733a2f2f706f7365722e707567782e6f72672f736f6e6174612d70726f6a6563742f676f6f676c652d61757468656e74696361746f722f642f6461696c79)](https://packagist.org/packages/sonata-project/google-authenticator)

BranchGithub ActionsCoverage2.x[![Test](https://github.com/sonata-project/GoogleAuthenticator/workflows/Test/badge.svg?branch=2.x)](https://github.com/sonata-project/GoogleAuthenticator/actions?query=workflow:test+branch:2.x)[![Coverage Status](https://camo.githubusercontent.com/9402c7f969687f9fa9cf8600749be3b7cb6f5b2b117dfd86e073493d7f7c0c16/68747470733a2f2f636f6465636f762e696f2f67682f736f6e6174612d70726f6a6563742f476f6f676c6541757468656e74696361746f722f6272616e63682f322e782f67726170682f62616467652e737667)](https://codecov.io/gh/sonata-project/GoogleAuthenticator/branch/2.x)3.x[![Test](https://github.com/sonata-project/GoogleAuthenticator/workflows/Test/badge.svg?branch=3.x)](https://github.com/sonata-project/GoogleAuthenticator/actions?query=workflow:test+branch:3.x)[![Coverage Status](https://camo.githubusercontent.com/7b64fa0f9635d17922fa9a838d854a17d783a8941b995265c1d32e7cc7294b70/68747470733a2f2f636f6465636f762e696f2f67682f736f6e6174612d70726f6a6563742f476f6f676c6541757468656e74696361746f722f6272616e63682f332e782f67726170682f62616467652e737667)](https://codecov.io/gh/sonata-project/GoogleAuthenticator/branch/3.x)Installation using Composer
---------------------------

[](#installation-using-composer)

```
composer require sonata-project/google-authenticator
```

Usage
-----

[](#usage)

See example.php for how to use it.

There's a little web app showing how it works in web/, please make users.dat writeable for the webserver, doesn't really work otherwise (it can't save the secret). Try to login with chregu/foobar.

What's missing in the example:

- Prevent replay attacks. One token should only be used once
- Show QR Code only when providing password again (or not at all)
- Regenerate secret

Support
-------

[](#support)

For general support and questions, please use [StackOverflow](http://stackoverflow.com/questions/tagged/sonata).

If you think you found a bug or you have a feature idea to propose, feel free to open an issue **after looking** at the [contributing guide](CONTRIBUTING.md).

License
-------

[](#license)

This package is available under the [MIT license](LICENSE).

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity67

Solid adoption and visibility

Community43

Growing community involvement

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 63.4% of commits — single point of failure

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

Every ~296 days

Recently: every ~319 days

Total

12

Last Release

1584d ago

Major Versions

1.1.0 → 2.0.02017-06-05

1.x-dev → 2.1.02018-04-09

2.x-dev → 3.x-dev2022-01-16

PHP version history (6 changes)1.0.0PHP &gt;=5.3.0

1.1.0PHP ^5.3 || ^7.0

2.0.0PHP ^7.0

2.1.0PHP ^7.1

2.3.0PHP &gt;=7.3

2.3.1PHP ^7.3 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/404157?v=4)[Sonata Project](/maintainers/sonata-project)[@sonata-project](https://github.com/sonata-project)

---

Top Contributors

[![SonataCI](https://avatars.githubusercontent.com/u/12843093?v=4)](https://github.com/SonataCI "SonataCI (236 commits)")[![greg0ire](https://avatars.githubusercontent.com/u/657779?v=4)](https://github.com/greg0ire "greg0ire (24 commits)")[![soullivaneuh](https://avatars.githubusercontent.com/u/1698357?v=4)](https://github.com/soullivaneuh "soullivaneuh (21 commits)")[![chregu](https://avatars.githubusercontent.com/u/47106?v=4)](https://github.com/chregu "chregu (17 commits)")[![bkernal626](https://avatars.githubusercontent.com/u/22935336?v=4)](https://github.com/bkernal626 "bkernal626 (14 commits)")[![core23](https://avatars.githubusercontent.com/u/3440437?v=4)](https://github.com/core23 "core23 (13 commits)")[![OskarStark](https://avatars.githubusercontent.com/u/995707?v=4)](https://github.com/OskarStark "OskarStark (8 commits)")[![jordisala1991](https://avatars.githubusercontent.com/u/1137485?v=4)](https://github.com/jordisala1991 "jordisala1991 (7 commits)")[![rande](https://avatars.githubusercontent.com/u/14672?v=4)](https://github.com/rande "rande (7 commits)")[![VincentLanglet](https://avatars.githubusercontent.com/u/9052536?v=4)](https://github.com/VincentLanglet "VincentLanglet (6 commits)")[![lstrojny](https://avatars.githubusercontent.com/u/79707?v=4)](https://github.com/lstrojny "lstrojny (3 commits)")[![linaori](https://avatars.githubusercontent.com/u/1754678?v=4)](https://github.com/linaori "linaori (3 commits)")[![zerkms](https://avatars.githubusercontent.com/u/302295?v=4)](https://github.com/zerkms "zerkms (2 commits)")[![franmomu](https://avatars.githubusercontent.com/u/720690?v=4)](https://github.com/franmomu "franmomu (2 commits)")[![o-rey](https://avatars.githubusercontent.com/u/5132302?v=4)](https://github.com/o-rey "o-rey (1 commits)")[![fiedsch](https://avatars.githubusercontent.com/u/5047601?v=4)](https://github.com/fiedsch "fiedsch (1 commits)")[![netniV](https://avatars.githubusercontent.com/u/9052188?v=4)](https://github.com/netniV "netniV (1 commits)")[![alvaroveliz](https://avatars.githubusercontent.com/u/224408?v=4)](https://github.com/alvaroveliz "alvaroveliz (1 commits)")[![paaaaaaaaaa](https://avatars.githubusercontent.com/u/672694?v=4)](https://github.com/paaaaaaaaaa "paaaaaaaaaa (1 commits)")[![petski](https://avatars.githubusercontent.com/u/116610?v=4)](https://github.com/petski "petski (1 commits)")

---

Tags

google-authenticatorphpsonatasymfonygoogle authenticator

### Embed Badge

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

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

###  Alternatives

[spomky-labs/otphp

A PHP library for generating one time passwords according to RFC 4226 (HOTP Algorithm) and the RFC 6238 (TOTP Algorithm) and compatible with Google Authenticator

1.5k46.1M119](/packages/spomky-labs-otphp)[scheb/2fa-google-authenticator

Extends scheb/2fa-bundle with two-factor authentication using Google Authenticator

298.2M30](/packages/scheb-2fa-google-authenticator)

PHPackages © 2026

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