PHPackages                             geoffry304/yii2-authy - 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. geoffry304/yii2-authy

ActiveYii2-extension[Authentication &amp; Authorization](/categories/authentication)

geoffry304/yii2-authy
=====================

Yii2 authy 2FA

2.0.8(7y ago)1771[1 issues](https://github.com/Geoffry304/yii2-authy/issues)BSD-3-ClausePHP

Since Jan 3Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Geoffry304/yii2-authy)[ Packagist](https://packagist.org/packages/geoffry304/yii2-authy)[ Docs](https://github.com/geoffry304/yii2-authy)[ RSS](/packages/geoffry304-yii2-authy/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (6)Versions (16)Used By (0)

yii2-authy
==========

[](#yii2-authy)

[![Latest Version](https://camo.githubusercontent.com/7e961d76d5fc047c5cc79904a1918ac075c1d0be13623376f28766b2274cff00/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f67656f666672793330342f796969322d61757468792e7376673f7374796c653d666c61742d737175617265266c6162656c3d72656c65617365)](https://github.com/geoffry304/yii2-authy/tags)[![Software License](https://camo.githubusercontent.com/b60331a2084501dc07cf6d6964c0da58dd005d89c45cf3b28b4b22b60f5ec00f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4253442d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/geoffry304/yii2-authy/blob/master/LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/3059506bfc005cbf5b52e923fb02f8b1d7fc337e9ace4745568281dfe904cc8e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f67656f666672793330342f796969322d61757468792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/geoffry304/yii2-authy)

Extension for using 2FA from Authy with Yii2 and amnah/yii2-user
----------------------------------------------------------------

[](#extension-for-using-2fa-from-authy-with-yii2-and-amnahyii2-user)

### Installation

[](#installation)

The preferred way to install **yii2-authy** is through [Composer](https://getcomposer.org/). Either add the following to the require section of your `composer.json` file:

`"geoffry304/yii2-authy": "*"`

Or run:

`$ php composer.phar require geoffry304/yii2-authy "*"`

You can manually install **yii2-authy** by [downloading the source in ZIP-format](https://github.com/geoffry304/yii2-authy/archive/master.zip).

Run the migration file `php yii migrate --migrationPath=@vendor/geoffry304/yii2-authy/migrations`

Update the config file

```
// app/config/web.php
return [
    'modules' => [
        'authy' => [
            'class' => 'geoffry304\authy\Module',
            'api_key' => 'here your api key from authy',
            'send_mail_from => 'demo@example.com'
        ],
        'user' => [
            'class' => 'amnah\yii2\user\Module',
            'modelClasses' => [
                'LoginForm' => 'geoffry304\authy\forms\LoginForm'
            ]
        ],
    ],
];
```

### Using Authy

[](#using-authy)

You need to add this piece of code before you try performLogin

```
$module2FA = Yii::$app->getModule('authy');
if ($module2FA) {
    Yii::$app->session->set('credentials', ['login' => $model->email, 'pwd' => $model->password, 'remember' => $rememberMe]);
    $returnUrl = $module2FA->validateLogin($model->getUser());
    return $returnUrl;
}
```

#### Options

[](#options)

**Module** Has the following options to modify it's behaviour:

- **api\_key**: The key you get from authy website to make connection with it.
- **api\_url**: If you want to use an other url standard to .
- **default\_expirytime**: The expire time the user will need to insert a new token standard to 30 days.
- **send\_mail**: Send mail when new device is added, standard to true.
- **send\_mail\_from**: Send mail from required when send\_mail is on.
- **logo**: Path tho logo used in confirmation and registration form and also in sending mail.

If you need extra security, you can check on every action and controller if the current session still exist in db.

Update the config file

```
// app/config/web.php
return [
    'bootstrap' => ['GlobalCheck'],
    'components' => [
        'GlobalCheck'=> [
            'class'=>'geoffry304\authy\components\GlobalCheck'
         ],
     ],
];
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity71

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

Recently: every ~72 days

Total

15

Last Release

2720d ago

Major Versions

1.2.1 → 2.02018-01-25

### Community

Maintainers

![](https://www.gravatar.com/avatar/f248f416d1f40cebd20eca0522da75eaac0a092a5339d15277c337cc4755ffda?d=identicon)[Geoffry304](/maintainers/Geoffry304)

---

Top Contributors

[![Geoffry304](https://avatars.githubusercontent.com/u/3656871?v=4)](https://github.com/Geoffry304 "Geoffry304 (22 commits)")

---

Tags

Authentication2fayii2extensionauthy2-Factor

### Embed Badge

![Health badge](/badges/geoffry304-yii2-authy/health.svg)

```
[![Health](https://phpackages.com/badges/geoffry304-yii2-authy/health.svg)](https://phpackages.com/packages/geoffry304-yii2-authy)
```

###  Alternatives

[nodge/yii2-eauth

Yii2 EAuth Extension. EAuth allows to authenticate users with accounts on other websites (Google, Facebook, Twitter, etc).

19399.4k](/packages/nodge-yii2-eauth)[sicaboy/laravel-mfa

A Laravel package of Multi-factor Authentication (MFA/2FA) with a middleware.

101.2k](/packages/sicaboy-laravel-mfa)

PHPackages © 2026

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