wearesho-team / yii-token-registration
This package is abandoned and no longer maintained.
The author suggests using the wearesho-team/yii-tokens package instead.
3.2.2
2019-04-09 11:20 UTC
Requires
- php: >=7.1
- horat1us/yii2-base: ^1.11
- nesbot/carbon: ^1.22
- wearesho-team/message-delivery: ^1.3
- yiisoft/yii2: ^2.0.14.2
Requires (Dev)
- phpunit/phpunit: ^6.3
- squizlabs/php_codesniffer: ^3.2
- vlucas/phpdotenv: ^2.4
This package is not auto-updated.
Last update: 2022-02-01 13:09:50 UTC
README
Verifying some action by sending token (SMS, Email, Telegram etc.)
Compatible only with MySQL and PostgreSQL
CHANGELOG
Installation
composer require wearesho-team/yii-tokens:^3.0
Migrations
- Copy migrations into your project
cd path-to-your-project
cp -R ./vendor/wearesho-team/yii-tokens/migrations ./console/migrations
Configuration
Environment
Default TokenRepositoryConfig loads configuration from environment variables. Environment variables name may be changed, defaults:
- TOKEN_EXPIRE_MINUTES - minutes from creating token when it will be invalidated
- TOKEN_VERIFY_LIMIT - maximum verifying limit (used by TokenValidator)
- TOKEN_DELIVERY_LIMIT - maximum sending limit (used by TokenRepository, send method)
Container
You should configure your DI-container to use environment config:
<?php // bootstrap.php use Wearesho\Yii\Interfaces\TokenRepositoryConfigInterface; use Wearesho\Yii\Configs\TokenRepositoryConfig; Yii::$container->set( TokenRepositoryConfigInterface::class, [ 'class' => TokenRepositoryConfig::class, // Changing environment variables names 'expirePeriodKey' => 'TOKEN_EXPIRE_MINUTES', // optional 'verifyLimitKey' => 'TOKEN_VERIFY_LIMIT', // optional 'deliveryLimitKey' => 'TOKEN_DELIVERY_LIMIT', // optional // Defaults (if no env variables set) 'defaultExpirePeriod' => 30, // optional 'defaultDeliveryLimit' => 3, // optional 'defaultVerifyLimit' => 3, // optional ] );
TODO
- Documentation
- Tests for exceptions
License
Unlicensed