PHPackages                             lion/authentication - 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. lion/authentication

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

lion/authentication
===================

Library to add 2FA security.

v6.0.3(4w ago)1732MITPHPPHP &gt;=8.5CI passing

Since Mar 3Pushed 4w ago1 watchersCompare

[ Source](https://github.com/Lion-Packages/authentication)[ Packagist](https://packagist.org/packages/lion/authentication)[ Docs](https://dev.lion-packages.com)[ RSS](/packages/lion-authentication/feed)WikiDiscussions 6.x Synced today

READMEChangelog (10)Dependencies (32)Versions (35)Used By (0)

[![presentation-lion-packages](https://private-user-images.githubusercontent.com/56183278/529806560-68290082-bc07-41de-9a7f-1dc6fe9b4d34.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODIxNjY2NDYsIm5iZiI6MTc4MjE2NjM0NiwicGF0aCI6Ii81NjE4MzI3OC81Mjk4MDY1NjAtNjgyOTAwODItYmMwNy00MWRlLTlhN2YtMWRjNmZlOWI0ZDM0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA2MjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNjIyVDIyMTIyNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTU4OTk3YzY0ODM5Nzk1MjgzMDhiYWRjMTIzZDhjMTNiMTE1MzIzMjVkZWEzZDdiNTliOGIwY2IxODlkMWU4OTUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.xcwBBBUaJRkbs4obRu59ivsw_NHPAuV2qXVTM4VQhD8)](https://private-user-images.githubusercontent.com/56183278/529806560-68290082-bc07-41de-9a7f-1dc6fe9b4d34.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODIxNjY2NDYsIm5iZiI6MTc4MjE2NjM0NiwicGF0aCI6Ii81NjE4MzI3OC81Mjk4MDY1NjAtNjgyOTAwODItYmMwNy00MWRlLTlhN2YtMWRjNmZlOWI0ZDM0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA2MjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNjIyVDIyMTIyNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTU4OTk3YzY0ODM5Nzk1MjgzMDhiYWRjMTIzZDhjMTNiMTE1MzIzMjVkZWEzZDdiNTliOGIwY2IxODlkMWU4OTUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.xcwBBBUaJRkbs4obRu59ivsw_NHPAuV2qXVTM4VQhD8) [ ![Latest Stable Version](https://camo.githubusercontent.com/560eb5b7feab62dd3b7e4ec734325d4fefa5aa5c004cababbf35f3bc67e174a1/68747470733a2f2f706f7365722e707567782e6f72672f6c696f6e2f61757468656e7469636174696f6e2f76) ](https://packagist.org/packages/lion/authentication) [ ![Total Downloads](https://camo.githubusercontent.com/1a8469d2da5ed6b7334629741851bf3c11ad277adc91cda7ee7e684028b60f0c/68747470733a2f2f706f7365722e707567782e6f72672f6c696f6e2f61757468656e7469636174696f6e2f646f776e6c6f616473) ](https://packagist.org/packages/lion/authentication) [ ![License](https://camo.githubusercontent.com/db85aecffb255e3896190e5bea05c5c6b787f373e2f4c95094c56af7f0aee986/68747470733a2f2f706f7365722e707567782e6f72672f6c696f6e2f61757468656e7469636174696f6e2f6c6963656e7365) ](https://github.com/lion-packages/authentication/blob/main/LICENSE) [ ![PHP Version Require](https://camo.githubusercontent.com/84ac3a357379e33819550e21975f94aedf6d4efcee8fd282d5a82b0c5198e801/68747470733a2f2f706f7365722e707567782e6f72672f6c696f6e2f61757468656e7469636174696f6e2f726571756972652f706870) ](https://www.php.net/)

🚀 **Lion-Authentication** Library to authenticate users with the 2FA method.

---

📖 Features
----------

[](#-features)

✔️ Generate security codes.
✔️ Generate QR codes.

---

📦 Installation
--------------

[](#-installation)

Install the authentication using **Composer**:

```
composer require lion/authentication pragmarx/google2fa-qrcode bacon/bacon-qr-code
```

Usage Example
-------------

[](#usage-example)

```
use Lion\Authentication\Auth2FA;

$auth2fa = new Auth2FA();

$qr = $auth2fa->qr('company_name', 'company_email', 200); // default size of 400
```

📝 License
---------

[](#-license)

The **authentication** is open-sourced software licensed under the [MIT License](https://github.com/lion-packages/authentication/blob/main/LICENSE).

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance93

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 72.5% 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 ~45 days

Total

27

Last Release

28d ago

Major Versions

v1.0.0 → v2.0.02023-12-16

2.x-dev → v3.0.02024-01-21

v3.1.0 → v4.0.02024-07-06

4.x-dev → v5.0.02024-12-01

v5.11.0 → v6.0.02025-12-23

PHP version history (4 changes)1.x-devPHP &gt;=8.1

v2.0.0PHP &gt;=8.2

v5.0.0PHP &gt;=8.4

v6.0.0PHP &gt;=8.5

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/139179826?v=4)[Lion-Packages](/maintainers/lion-packages)[@lion-packages](https://github.com/lion-packages)

---

Top Contributors

[![Sleon4](https://avatars.githubusercontent.com/u/56183278?v=4)](https://github.com/Sleon4 "Sleon4 (103 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (18 commits)")[![GabrielPalac](https://avatars.githubusercontent.com/u/162063476?v=4)](https://github.com/GabrielPalac "GabrielPalac (8 commits)")[![mcesmeralda](https://avatars.githubusercontent.com/u/96641807?v=4)](https://github.com/mcesmeralda "mcesmeralda (6 commits)")[![LeinadAlberto](https://avatars.githubusercontent.com/u/127895160?v=4)](https://github.com/LeinadAlberto "LeinadAlberto (5 commits)")[![MMarioLP](https://avatars.githubusercontent.com/u/105904645?v=4)](https://github.com/MMarioLP "MMarioLP (2 commits)")

---

Tags

2fa2fa-security2factorphpsecurityAuthenticationlionlion-authentication

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/lion-authentication/health.svg)

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

###  Alternatives

[tymon/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

11.7k51.8M369](/packages/tymon-jwt-auth)[league/oauth2-server

A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.

6.7k147.0M288](/packages/league-oauth2-server)[league/oauth2-client

OAuth 2.0 Client Library

3.8k128.7M1.3k](/packages/league-oauth2-client)[google/auth

Google Auth Library for PHP

1.4k294.2M216](/packages/google-auth)[pragmarx/google2fa

A One Time Password Authentication package, compatible with Google Authenticator.

2.0k97.9M236](/packages/pragmarx-google2fa)[paragonie/sodium_compat

Pure PHP implementation of libsodium; uses the PHP extension if it exists

931145.2M176](/packages/paragonie-sodium-compat)

PHPackages © 2026

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