PHPackages                             lemonade/two-factor - 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. lemonade/two-factor

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

lemonade/two-factor
===================

TOTP two-factor authentication component for PHP 8.1+.

v1.1.0(today)10MITPHPPHP &gt;=8.1CI passing

Since Jun 9Pushed todayCompare

[ Source](https://github.com/johnnyxlemonade/two-factor)[ Packagist](https://packagist.org/packages/lemonade/two-factor)[ Docs](https://github.com/johnnyxlemonade/two-factor)[ RSS](/packages/lemonade-two-factor/feed)WikiDiscussions master Synced today

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

Lemonade Two Factor
===================

[](#lemonade-two-factor)

[![PHPStan](https://github.com/johnnyxlemonade/two-factor/actions/workflows/phpstan.yml/badge.svg)](https://github.com/johnnyxlemonade/two-factor/actions/workflows/phpstan.yml)[![Tests](https://github.com/johnnyxlemonade/two-factor/actions/workflows/phpunit.yml/badge.svg)](https://github.com/johnnyxlemonade/two-factor/actions/workflows/phpunit.yml)[![Lint](https://github.com/johnnyxlemonade/two-factor/actions/workflows/lint.yml/badge.svg)](https://github.com/johnnyxlemonade/two-factor/actions/workflows/lint.yml)[![Coding Standards](https://github.com/johnnyxlemonade/two-factor/actions/workflows/cs.yml/badge.svg)](https://github.com/johnnyxlemonade/two-factor/actions/workflows/cs.yml)

TOTP two-factor authentication component for PHP 8.1+.

The package provides a small, dependency-light TOTP implementation with Base32 secret handling, `otpauth://` URI generation, QR image providers, and a factory-based public API.

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

[](#requirements)

- PHP `>=8.1`
- `ext-hash`
- `ext-json`

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

[](#installation)

```
composer require lemonade/two-factor
```

Basic Usage
-----------

[](#basic-usage)

Create the component through `AppTwoFactorFactory`:

```
