PHPackages                             sebastiandevs/simplethenticator - 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. sebastiandevs/simplethenticator

ActiveLibrary

sebastiandevs/simplethenticator
===============================

TOTP based on https://github.com/PHPGangsta/GoogleAuthenticator updated and reworked to php8.2 because of inactivity of the original creator.

1.2(3mo ago)1315.8k—5%BSD-2-ClausePHPPHP &gt;=8.2CI passing

Since Dec 9Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/poetter-sebastian/SimpleThenticator)[ Packagist](https://packagist.org/packages/sebastiandevs/simplethenticator)[ Docs](https://poetter-sebastian.github.io/)[ RSS](/packages/sebastiandevs-simplethenticator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (1)Versions (9)Used By (0)

SimpleThenticator
=================

[](#simplethenticator)

- Copyright (c) 2025, [https://poetter-sebastian.github.io](https://poetter-sebastian.github.io/)
- Author: Sebastian Pötter, ([@PHPGangsta](https://github.com/PHPGangsta/GoogleAuthenticator), [contributors](https://github.com/PHPGangsta/GoogleAuthenticator/graphs/contributors)) and [contributors](https://github.com/poetter-sebastian/SimpleThenticator/graphs/contributors)
- Licensed under the [BSD 2-Clause "Simplified" License](https://github.com/poetter-sebastian/SimpleThenticator/blob/main/LICENSE).

 [ ![Software License](https://camo.githubusercontent.com/ef19456eda76d68644f515566a01a1abf4c23aa46575f82dcee148d50dd72759/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6973656e63652d4253445f325f436c617573652d677265656e3f7374796c653d666c61742d737175617265) ](LICENSE) [ ![Total Downloads](https://camo.githubusercontent.com/424d0d86e4f89ef7cacc834d29eb4f5c2743df2276cf6b51a3488b93d6ff3f63/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73656261737469616e646576732f73696d706c657468656e74696361746f722e7376673f7374796c653d666c61742d737175617265) ](https://packagist.org/packages/sebastiandevs/simplethenticator) [ ![Latest Stable Version](https://camo.githubusercontent.com/226b9589fd02b0462b8189d4ef0c51c0538f46949d41a27e1135e0772ebadabe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73656261737469616e646576732f73696d706c657468656e74696361746f722e7376673f7374796c653d666c61742d737175617265266c6162656c3d737461626c65) ](https://packagist.org/packages/sebastiandevs/simplethenticator) [ ![Latest Stable Version](https://github.com/poetter-sebastian/SimpleThenticator/actions/workflows/phpunit_tests.yml/badge.svg?branch=develop) ](https://github.com/poetter-sebastian/SimpleThenticator/actions/workflows/phpunit_tests.yml)

This class can generate secrets, generate codes, validate codes and present a QR-Code for scanning the secret. It implements TOTP according to [RFC6238](https://tools.ietf.org/html/rfc6238)

**Other hash functions other than SHA1 only work for Google-Authenticator at the moment!**

Example:
--------

[](#example)

Look at the function [TestGenerator()](https://github.com/poetter-sebastian/SimpleThenticator/blob/main/tests/SimpleAuthenticatorTest.php) in [tests](https://github.com/poetter-sebastian/SimpleThenticator/tree/main/tests)

Or use this [sample script](https://github.com/poetter-sebastian/SimpleThenticator/blob/main/sample/sample.php):

```
require_once('../src/SimpleAuthenticator.php');

use SebastianDevs\SimpleAuthenticator;

$auth = new SimpleAuthenticator(6, 'SHA1');
try
{
    $secret = $auth->createSecret();
}
catch (Exception $e)
{
    echo $e->getMessage();
    exit();
}
echo 'Secret is: ' . $secret . '\n';

$qrCodeUrl = $auth->getQRCodeGoogleUrl($secret, 'Testo@test.test', 'Business');
echo 'QR-Code: ' . $qrCodeUrl . '\n';

$oneCode = $auth->getCode($secret);
echo 'Checking Code ' . $oneCode . ' and Secret ' . $secret . ':\n';

echo $auth->verifyCode($secret, $oneCode, 2)? 'OK': 'NOT OK';
```

output:

```
Secret is: S4VWK6CWPA3PMU2HZM2YEDZGSF2DQL3V

Google Charts URL for the QR-Code: https://api.qrserver.com/v1/create-qr-code/?data=otpauth%3A%2F%2Ftotp%2FVintage+Story%3ATesto%40test.test%3Fsecret%3DS4VWK6CWPA3PMU2HZM2YEDZGSF2DQL3V%26algorithm%3DSHA256%26issuer%3DVintage+Story&size=200x200&ecc=M

Checking Code '439195' and Secret 'S4VWK6CWPA3PMU2HZM2YEDZGSF2DQL3V':
OK

```

Installation:
-------------

[](#installation)

### [Composer](https://getcomposer.org/doc/01-basic-usage.md)

[](#composer)

- To use this package perform the following command:

`composer require sebastiandevs/simplethenticator`

### Simple usage

[](#simple-usage)

- To use the class just import the [SimpleAuthenticator.php](https://github.com/poetter-sebastian/SimpleThenticator/blob/main/src/SimpleAuthenticator.php) as `require_once()` in your PHP code

Run Tests:
----------

[](#run-tests)

- All tests are inside the [tests folder](https://github.com/poetter-sebastian/SimpleThenticator/tree/main/tests).
- Execute `composer run-script build-dev` to install all dependencies
- Execute `composer run-script test` to run all tests in the test folder

Better library:
---------------

[](#better-library)

- For better code or complex implementations: please use [RobThree/TwoFactorAuth](https://github.com/RobThree/TwoFactorAuth)!

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance82

Actively maintained with recent releases

Popularity33

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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 ~199 days

Total

5

Last Release

93d ago

PHP version history (2 changes)1.0PHP &gt;=8.1

1.1PHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/10c33bd553f39943b47463b95bbdc065494bb7e089219392c7040ace77472517?d=identicon)[poetter-sebastian](/maintainers/poetter-sebastian)

---

Top Contributors

[![poetter-sebastian](https://avatars.githubusercontent.com/u/32681913?v=4)](https://github.com/poetter-sebastian "poetter-sebastian (54 commits)")

---

Tags

authenticatorcomposerlibraryphp-authenticatephp-authenticationphp-google-authenticatorphp-totpphp8phpunit-teststotptotp2fa2 factor authenticator library

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sebastiandevs-simplethenticator/health.svg)

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

###  Alternatives

[paragonie/multi-factor

Vendor-agnostic two-factor authentication library

142195.5k2](/packages/paragonie-multi-factor)[scheb/2fa-totp

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

292.7M22](/packages/scheb-2fa-totp)[2amigos/2fa-library

2 Factor Authentication (2FA) library

34367.1k7](/packages/2amigos-2fa-library)[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)[jiripudil/otp

Library that generates and verifies one-time passwords.

2825.4k1](/packages/jiripudil-otp)[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)
