PHPackages                             nanasess/twofactorauth18 - 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. nanasess/twofactorauth18

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

nanasess/twofactorauth18
========================

Two Factor Authentication

v3.0.2(1y ago)06MITPHPPHP &gt;=8.2.0

Since Mar 23Pushed 1y agoCompare

[ Source](https://github.com/nanasess/TwoFactorAuth18)[ Packagist](https://packagist.org/packages/nanasess/twofactorauth18)[ Docs](https://github.com/RobThree/TwoFactorAuth)[ Fund](https://paypal.me/robiii)[ GitHub Sponsors](https://github.com/RobThree)[ RSS](/packages/nanasess-twofactorauth18/feed)WikiDiscussions 1.8 Synced 1mo ago

READMEChangelogDependencies (3)Versions (27)Used By (0)

[![Logo](https://raw.githubusercontent.com/RobThree/TwoFactorAuth/master/logo.png)](https://raw.githubusercontent.com/RobThree/TwoFactorAuth/master/logo.png) PHP library for Two Factor Authentication
=======================================================================================================================================================================================================

[](#-php-library-for-two-factor-authentication)

[![Build status](https://camo.githubusercontent.com/b5629bca2262d129d8a3bf915cf6020d900a602c0322cfe9e70583454f337340/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f526f6254687265652f54776f466163746f72417574682f546573742f6d61737465723f7374796c653d666c61742d737175617265)](https://github.com/RobThree/TwoFactorAuth/actions?query=branch%3Amaster) [![Latest Stable Version](https://camo.githubusercontent.com/802b233e5c2ed29f4fd96f4cb2ddee9f4ad378d6ce223b37cb96b69e2767aa33/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726f6274687265652f74776f666163746f72617574682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/robthree/twofactorauth) [![License](https://camo.githubusercontent.com/1e632bb70a6d1a30c559f4c2cf4030548efb90ed2bee73006a33ca6adc4c65d3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f726f6274687265652f74776f666163746f72617574682e7376673f7374796c653d666c61742d737175617265)](LICENSE) [![Downloads](https://camo.githubusercontent.com/be527f90e63919b3387bfe416e76edfa2a6aee8001c083a73ea3ea606665b553/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f6274687265652f74776f666163746f72617574682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/robthree/twofactorauth) [![Code Climate](https://camo.githubusercontent.com/d7602130702625f0ce9971fa08ea861b6b98672736be55181509e45ffa29fd4d/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636c696d6174652f6769746875622f526f6254687265652f54776f466163746f72417574682e7376673f7374796c653d666c61742d737175617265)](https://codeclimate.com/github/RobThree/TwoFactorAuth) [![PayPal donate button](https://camo.githubusercontent.com/08ba1e39ba8b1ea78b5edae102d80c233c3da90fcbb88ac43493c20945ae6729/687474703a2f2f696d672e736869656c64732e696f2f62616467652f70617970616c2d646f6e6174652d6f72616e67652e7376673f7374796c653d666c61742d737175617265)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6MB5M2SQLP636 "Keep me off the streets")

PHP library for [two-factor (or multi-factor) authentication](http://en.wikipedia.org/wiki/Multi-factor_authentication) using [TOTP](http://en.wikipedia.org/wiki/Time-based_One-time_Password_Algorithm) and [QR-codes](http://en.wikipedia.org/wiki/QR_code). Inspired by, based on but most importantly an *improvement* on '[PHPGangsta/GoogleAuthenticator](https://github.com/PHPGangsta/GoogleAuthenticator)'. There's a [.Net implementation](https://github.com/RobThree/TwoFactorAuth.Net) of this library as well.

[![](https://raw.githubusercontent.com/RobThree/TwoFactorAuth/master/multifactorauthforeveryone.png)](https://raw.githubusercontent.com/RobThree/TwoFactorAuth/master/multifactorauthforeveryone.png)

Requirements
------------

[](#requirements)

- Tested on PHP 5.6 up to 8.0
- [cURL](http://php.net/manual/en/book.curl.php) when using the provided `QRServerProvider` (default), `ImageChartsQRCodeProvider` or `QRicketProvider` but you can also provide your own QR-code provider.
- [random\_bytes()](http://php.net/manual/en/function.random-bytes.php), [MCrypt](http://php.net/manual/en/book.mcrypt.php), [OpenSSL](http://php.net/manual/en/book.openssl.php) or [Hash](http://php.net/manual/en/book.hash.php) depending on which built-in RNG you use (TwoFactorAuth will try to 'autodetect' and use the best available); however: feel free to provide your own (CS)RNG.

Optionally, you may need:

- [sockets](https://www.php.net/manual/en/book.sockets.php) if you are using `NTPTimeProvider`
- [endroid/qr-code](https://github.com/endroid/qr-code) if using `EndroidQrCodeProvider` or `EndroidQrCodeWithLogoProvider`.
- [bacon/bacon-qr-code](https://github.com/Bacon/BaconQrCode) if using `BaconQrCodeProvider`.

Installation
------------

[](#installation)

The best way of installing this library is with composer:

`php composer.phar require robthree/twofactorauth`

Usage
-----

[](#usage)

For a quick start, have a look at the [getting started](https://robthree.github.io/TwoFactorAuth/getting-started.html) page or try out the [demo](demo/demo.php).

If you need more in-depth information about the configuration available then you can read through the rest of [documentation](https://robthree.github.io/TwoFactorAuth).

Integrations
------------

[](#integrations)

- [CakePHP 3](https://github.com/andrej-griniuk/cakephp-two-factor-auth)

License
-------

[](#license)

Licensed under MIT license. See [LICENSE](https://raw.githubusercontent.com/RobThree/TwoFactorAuth/master/LICENSE) for details.

[Logo / icon](http://www.iconmay.com/Simple/Travel_and_Tourism_Part_2/luggage_lock_safety_baggage_keys_cylinder_lock_hotel_travel_tourism_luggage_lock_icon_465) under CC0 1.0 Universal (CC0 1.0) Public Domain Dedication ([Archived page](http://riii.nl/tm7ap))

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance40

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity86

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 75.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 ~148 days

Recently: every ~98 days

Total

25

Last Release

515d ago

Major Versions

1.8.2 → v2.0.02023-02-25

v2.1.0 → v3.0.02024-05-27

PHP version history (4 changes)1.0PHP &gt;=5.3.0

1.7.0PHP &gt;=5.6.0

v2.0.0PHP &gt;=8.1.0

v3.0.0PHP &gt;=8.2.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/f2faa579847aa7f6045f80f897a15978403c8a3e0c1198f3d1ff72e32989309b?d=identicon)[nanasess](/maintainers/nanasess)

---

Top Contributors

[![RobThree](https://avatars.githubusercontent.com/u/607888?v=4)](https://github.com/RobThree "RobThree (193 commits)")[![willpower232](https://avatars.githubusercontent.com/u/1619102?v=4)](https://github.com/willpower232 "willpower232 (33 commits)")[![MasterOdin](https://avatars.githubusercontent.com/u/1845314?v=4)](https://github.com/MasterOdin "MasterOdin (9 commits)")[![igorsantos07](https://avatars.githubusercontent.com/u/532299?v=4)](https://github.com/igorsantos07 "igorsantos07 (5 commits)")[![fman42](https://avatars.githubusercontent.com/u/46138641?v=4)](https://github.com/fman42 "fman42 (5 commits)")[![nanasess](https://avatars.githubusercontent.com/u/815715?v=4)](https://github.com/nanasess "nanasess (4 commits)")[![anvyst](https://avatars.githubusercontent.com/u/227261?v=4)](https://github.com/anvyst "anvyst (2 commits)")[![brainfoolong](https://avatars.githubusercontent.com/u/1684236?v=4)](https://github.com/brainfoolong "brainfoolong (2 commits)")[![JonathanTru](https://avatars.githubusercontent.com/u/20085132?v=4)](https://github.com/JonathanTru "JonathanTru (1 commits)")[![andrej-griniuk](https://avatars.githubusercontent.com/u/2722793?v=4)](https://github.com/andrej-griniuk "andrej-griniuk (1 commits)")[![SavageCore](https://avatars.githubusercontent.com/u/171312?v=4)](https://github.com/SavageCore "SavageCore (1 commits)")

---

Tags

phpAuthenticationTwo Factor AuthenticationMFAauthyauthenticatortfaMulti Factor Authentication

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/nanasess-twofactorauth18/health.svg)

```
[![Health](https://phpackages.com/badges/nanasess-twofactorauth18/health.svg)](https://phpackages.com/packages/nanasess-twofactorauth18)
```

###  Alternatives

[robthree/twofactorauth

Two Factor Authentication

1.2k10.5M65](/packages/robthree-twofactorauth)[ellaisys/aws-cognito

AWS Cognito package that allows Auth and other related features using the AWS SDK for PHP

120220.7k1](/packages/ellaisys-aws-cognito)[paragonie/multi-factor

Vendor-agnostic two-factor authentication library

142195.5k2](/packages/paragonie-multi-factor)[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)[awes-io/auth

Laravel Authentication package with built-in two-factor (Authy) and social authentication (Socialite).

3826.7k1](/packages/awes-io-auth)[remotemerge/totp-php

Lightweight, fast, and secure TOTP (2FA) authentication library for PHP — battle tested, dependency free, and ready for enterprise integration.

2010.2k](/packages/remotemerge-totp-php)

PHPackages © 2026

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