PHPackages                             mincdev/php-otpauth - 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. [Security](/categories/security)
4. /
5. mincdev/php-otpauth

ActiveLibrary[Security](/categories/security)

mincdev/php-otpauth
===================

A library for genrating a 2 factor authentication QR code

1.0.1(4y ago)532.3k↓13.1%MITPHP

Since Oct 19Pushed 3y ago2 watchersCompare

[ Source](https://github.com/MincDev/php-2-factor-authentication)[ Packagist](https://packagist.org/packages/mincdev/php-otpauth)[ RSS](/packages/mincdev-php-otpauth/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

php-otpauth
===========

[](#php-otpauth)

A library for generating a 2 factor authentication QR code to use with Google Authenticator, Authy, etc.

### Secure QRCode Creation

[](#secure-qrcode-creation)

This library has secure QRCode creation because of the fact that the QRCode is generated locally on your server. This means that the user's secret is not passed to any third party or remote server in order to generate a code. This was inspired by the stack overflow answer by **kravietz** as seen [here](https://stackoverflow.com/a/56737468/3948544)

### Installation (Composer)

[](#installation-composer)

```
composer require mincdev/php-otpauth

```

### Dependencies

[](#dependencies)

This library requires the **tc-lib-barcode** library found at .

**Note:** The tc-lib-barcode library is maintained and owned by a separate entity.

#### Generating a QR Code

[](#generating-a-qr-code)

You can generate a QR code which can be scanned by Google Authenticator, Authy, etc. by using the below.

```
$otpAuth = new OtpAuthenticator();

$userName = "MrDoe";
$appName = "My Awesome App";

// Store this secret somewhere safe, as you'll need it to validate the pin later
$userSecret = $otpAuth->newSecret();

$qrBase64 = $otpAuth->getQR($userName, $appName, $userSecret);
```

#### Validating a PIN

[](#validating-a-pin)

Once your user logs in, you can validate their pin by making use of the following:

```
$otpAuth = new OtpAuthenticator();
$isValid = $otpAuth->validate($userSecret, $pinCode);
```

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

1694d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/18619993?v=4)[Christopher Smit](/maintainers/MincDev)[@MincDev](https://github.com/MincDev)

---

Top Contributors

[![MincDev](https://avatars.githubusercontent.com/u/18619993?v=4)](https://github.com/MincDev "MincDev (2 commits)")

---

Tags

2-factor-authentication2fa2fa-securitygoogle-authenticatorgoogle-authenticator-phpmulti-factorphp-2-factor-authenticationphp-2faphp-2factor-authqrcodesecuritytotp

### Embed Badge

![Health badge](/badges/mincdev-php-otpauth/health.svg)

```
[![Health](https://phpackages.com/badges/mincdev-php-otpauth/health.svg)](https://phpackages.com/packages/mincdev-php-otpauth)
```

###  Alternatives

[tecnickcom/tc-lib-pdf

PHP PDF Library

1.8k489.4k10](/packages/tecnickcom-tc-lib-pdf)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k18.0M133](/packages/mews-purifier)[paragonie/ecc

PHP Elliptic Curve Cryptography library

24772.0k35](/packages/paragonie-ecc)[fof/recaptcha

Increase your forum's security with Google reCAPTCHA

1436.9k](/packages/fof-recaptcha)[enupal/backup

Fully integrated Backup solution for Craft CMS

1612.5k1](/packages/enupal-backup)[thomaswelton/laravel-mcrypt-faker

Allows installation of Laravel where the PHP Mcrypt extension is not available. Provides encryption using OpenSSL, or by disabling encryption entierly.

114.0k](/packages/thomaswelton-laravel-mcrypt-faker)

PHPackages © 2026

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