PHPackages                             fat2fast/yii2-otp - 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. fat2fast/yii2-otp

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

fat2fast/yii2-otp
=================

Fat Too Fast YII2 extension for generating one time passwords according to RFC 4226/6238 (HOTP/TOTP Algorithm) and authentication widget , Upgrade version lib 2amigos/qrcode-library and spomky-labs/otphp from https://github.com/sam002/yii2-otp (sam002/yii2-otp) Support PHP to ^8.0

1.0.1(1y ago)0911GPL-3.0PHPPHP &gt;=7.0.0

Since Oct 27Pushed 1y ago1 watchersCompare

[ Source](https://github.com/fat2fast/yii2-otp)[ Packagist](https://packagist.org/packages/fat2fast/yii2-otp)[ Docs](https://github.com/fat2fast/yii2-otp)[ RSS](/packages/fat2fast-yii2-otp/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (1)

 [](https://github.com/fat2fast/yii2-otp)

Fat Too Fast Yii2 OTP
=====================

[](#fat-too-fast-yii2-otp)

### Fork from [Lsat Yii2 OTP](https://git.lcsa.vn/packages/yii2-otp)

[](#fork-from-lsat-yii2-otp)

### How to install

[](#how-to-install)

```
docker-compose exec api composer require fat2fast/yii2-otp:~1.0.0
```

Or

```
composer require fat2fast/yii2-otp:~1.0.0
```

or Add

```
"fat2fast/yii2-otp" : "~1.0.0"
```

to the require section of your application's `composer.json` file.

### Add components to web.php or console.php

[](#add-components-to-webphp-or-consolephp)

```
'components' => [
    'otp' => [
        'class' => fat2fast\otp\Otp::class,
        // 'totp' only now
        'algorithm' => fat2fast\otp\Otp::ALGORITHM_TOTP,

        // length of code
        'digits' => 6,

        //  Algorithm for hashing
        'digest' => 'sha1',

        // Label of application
        'label' => 'Label name',

        // Uri to image (application icon)
//            'imgLabelUrl' => \yii\helpers\Url::to('\app\web\logo.php'),

        // Betwen 8 and 1024
        'secretLength' => 72,
        // Time interval in seconds, must be at least 1
        'interval' => 30,
        'issuer' => 'appIssuer',
    ],
]
```

### Use Behavior

[](#use-behavior)

Set behavior in model

```
