yiicod/tokenmanager

This package is abandoned and no longer maintained. The author suggests using the yiicod/tokenmanager package instead.

Token manager for the Yii framework

Installs: 53

Dependents: 0

Suggesters: 0

Security: 0

Type:yii-extension

0.1.0 2017-01-19 16:20 UTC

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);