wearesho-team / yii-tokens
This package is abandoned and no longer maintained.
The author suggests using the wearesho-team/yii2-tokens package instead.
Yii2 Tokens Library (internal, legacy)
Package info
github.com/wearesho-team/yii-tokens
Type:proprietary
pkg:composer/wearesho-team/yii-tokens
5.2.0
2026-10-26 11:39 UTC
Requires
- php: >=8.4
- horat1us/yii2-carbon-behavior: ^1.4
- horat1us/yii2-validation-exception: ^1.2
- nesbot/carbon: ^3.2 || ^2.73
- wearesho-team/message-delivery: ^2.1
- yiisoft/yii2: ^2.0.54
Requires (Dev)
- horat1us/yii2-asset-free: ^1.1
- phpunit/phpunit: ^13.4
- squizlabs/php_codesniffer: ^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-master
- 5.2.0
- 5.1.0
- 5.0.0
- 5.0.0-beta
- 4.1.0
- 4.0.0
- 3.2.2
- 3.2.1
- 3.2.0
- 3.1.0
- 3.0.0
- 2.1.0
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.3.0
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.0
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 1.0.0-rc3
- 1.0.0-rc2
- 1.0.0-rc1
- 1.0.0-beta2
- 1.0.0-beta
- dev-php-8.4
- dev-feature/after-send-event
- dev-release/4
- dev-feature/validation-error-message
- dev-feature/validation-refactor
This package is auto-updated.
Last update: 2026-10-26 12:18:10 UTC
README
Verifying some action by sending token (SMS, Email, Telegram etc.)
Compatible only with MySQL and PostgreSQL
Compatibility: tested on PHP 8.4, PHP 8.5
CHANGELOG
Installation
composer require wearesho-team/yii-tokens:^5.2
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 ] );
Contribution
Run Tests
Run test PostgreSQL database
docker compose up -d
Run tests
composer lint
composer test
Down test PostgreSQL database
docker compose down
TODO
- Documentation
- Tests for exceptions
License
Unlicensed