yii-jwt JSON Web Tokens (JWT) extension in Yii 1.

  1. YII-JWT
  2. Requirements
  3. Installation
  4. Usage
  5. Repository

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.

Usage

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

Repository

Github: https://github.com/NabiKAZ/yii-jwt

2 0
1 follower
2 downloads
Yii Version: 1.1
License: GPL-3.0
Category: Security
Tags: jwt, Yii
Developed by: Nabi
Created on: Mar 9, 2017
Last updated: 7 years ago

Related Extensions