PHPackages                             fortytwo/php-sdk-two-factor-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. fortytwo/php-sdk-two-factor-authentication

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

fortytwo/php-sdk-two-factor-authentication
==========================================

Fortytwo’s Two-Factor Authentication (2FA) API adds an additional layer of security to your users’ login credentials with a unique one-time code which limits the risk of fraudulent access to your website.

1.4.1(9y ago)01.2k1MITPHPPHP &gt;=5.3.3

Since Feb 16Pushed 9y ago3 watchersCompare

[ Source](https://github.com/42Telecom/php-sdk-two-factor-authentication)[ Packagist](https://packagist.org/packages/fortytwo/php-sdk-two-factor-authentication)[ RSS](/packages/fortytwo-php-sdk-two-factor-authentication/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (10)Dependencies (2)Versions (13)Used By (1)

TWO FACTOR AUTHENTICATION FOR FORTYTWO
======================================

[](#two-factor-authentication-for-fortytwo)

This SDK help you to use the Two Factor Authentication service from [FortyTwo Telecom](http://www.fortytwo.com)

How to use it:
--------------

[](#how-to-use-it)

### With composer:

[](#with-composer)

Using [composer](https://getcomposer.org/):

```
    composer require fortytwo/php-sdk-two-factor-authentication

```

### directly:

[](#directly)

You can download the library from the [Fortytwo Telecom website](https://www.fortytwo.com/developers/) or on our [official Github repository](https://github.com/42Telecom/php-sdk-two-factor-authentication).

Testing:
--------

[](#testing)

Execute the following command on the project directory:

```
vendor/bin/phpunit -c tests/Phpunit.xml

```

Currently the code coverage is 100%.

API:
----

[](#api)

The SDK expose 2 main functions:

### TwoFactorAuthentication::requestCode()

[](#twofactorauthenticationrequestcode)

Parameters:

NameTypeRequiredDescriptionclientRefStringYesClient reference.phoneNumberStringYesDestination Phone number.optionalArgsArrayNoList of optionals argumentsList of optionals arguments:

NameTypeDefaultConstraintsDescriptioncodeLengthInteger6Maximum value 202FA CodecodeTypeStringNumericalpha, numeric or alphanumeric2FA Code type.caseSensitiveBooleannullTrue or False2FA Code case sensitivecallbackUrlStringnullURL format withscheme (http/https)2FA Callback URL.senderIdStringnull-Custom sender ID.messageTemplateStringnull{#TFA\_CODE} RequiredCustom message templateYou can found a more detailled description of each parameter in the [API documentation](https://www.fortytwo.com/apis/two-factor-authentication/request-code/)

### TwoFactorAuthentication::validateCode()

[](#twofactorauthenticationvalidatecode)

Parameters:

NameTypeRequiredDescriptionclientRefStringYesClient reference.codeStringYes2FA Code.You can found a more detailled description of each parameter in the [API documentation](https://www.fortytwo.com/apis/two-factor-authentication/validate-code/)

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity65

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

Recently: every ~33 days

Total

11

Last Release

3577d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10790107?v=4)[Fortytwo](/maintainers/Fortytwo)[@FortyTwo](https://github.com/FortyTwo)

---

Top Contributors

[![sebastien-lemarinel](https://avatars.githubusercontent.com/u/17295218?v=4)](https://github.com/sebastien-lemarinel "sebastien-lemarinel (37 commits)")

---

Tags

2faTwo Factor Authentication2 factor authenticationfortytwo

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fortytwo-php-sdk-two-factor-authentication/health.svg)

```
[![Health](https://phpackages.com/badges/fortytwo-php-sdk-two-factor-authentication/health.svg)](https://phpackages.com/packages/fortytwo-php-sdk-two-factor-authentication)
```

###  Alternatives

[pragmarx/google2fa

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

2.0k97.9M235](/packages/pragmarx-google2fa)[pragmarx/google2fa-qrcode

QR Code package for Google2FA

12532.0M54](/packages/pragmarx-google2fa-qrcode)[paragonie/multi-factor

Vendor-agnostic two-factor authentication library

142198.6k2](/packages/paragonie-multi-factor)[ellaisys/aws-cognito

Laravel Authentication using AWS Cognito (Web and API)

123256.9k1](/packages/ellaisys-aws-cognito)[stephenjude/filament-two-factor-authentication

Filament Two Factor Authentication: Google 2FA + Passkey Authentication

84215.9k9](/packages/stephenjude-filament-two-factor-authentication)[emargareten/two-factor-laravel

Two-factor authentication implementation for Laravel applications.

4032.9k](/packages/emargareten-two-factor-laravel)

PHPackages © 2026

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