yiicod / tokenmanager
Token manager for the Yii framework
Installs: 54
Dependents: 0
Suggesters: 0
Security: 0
Type:yii-extension
pkg:composer/yiicod/tokenmanager
This package is not auto-updated.
Last update: 2022-02-01 13:04:45 UTC
README
With this extension you easy generate token on one application and use this token on other application. Tokens are saved on the MongDB/MySQL.
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist yiicod/tokenmanager "*"
or add
"yiicod/tokenmanager": "*"
Config ( This is all config for extensions ):
'components' => [
...
'tokenManager' => [
'class' => 'yiicod\tokenmanager\MongoDbPhp7TokenManager',
'connectionString' => 'mongodb://IP:PORT',
'privateKey' => 'Required',
'dbName' => 'DB name',
'collectionName' => 'Collection name',
]
]
Generate token:
Yii::app()->tokenManager->generate(array('id' => $model->id))
Load token:
$token = Yii::app()->tokenManager->load($token);
Validate token:
Yii::app()->tokenManager->validate($token);