Skip to content

NabiKAZ/yii-jwt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

YII-JWT

JSON Web Tokens (JWT) in Yii 1.

Base PHP codes is php-jwt.

Requirements

Yii Framework 1.1 or above.

Installation

Extract all files under jwt folder name in extensions folder.

And put the following code in protected/config/main.php

'components'=>array(
    ...
    'JWT' => array(
        'class' => 'ext.jwt.JWT',
        'key' => 'HERE-INPUT-YOUR-SECRET-KEY',
    ),
    ...
),

Do not forget enter a suitable and complex secret key.

Example

$token = array(
    "blog" => "http://weblog.nabi.ir",
    "name" => "nabi",
    "date" => "2017-03-09",
    "number" => 1396
);

$jwt = Yii::app()->JWT->encode($token);
var_dump($jwt);

$decode = Yii::app()->JWT->decode($jwt);
var_dump($decode);

About

JWT extension for PHP Yii1 Framework

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages