2017 © Pedro Peláez
 

yii2-extension yii2-jwt

Set of classes for easier JWT integration

image

wilianto/yii2-jwt

Set of classes for easier JWT integration

  • Sunday, January 3, 2016
  • by wilianto
  • Repository
  • 0 Watchers
  • 0 Stars
  • 56 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 18 Forks
  • 0 Open issues
  • 2 Versions
  • 4 % Grown

The README.md

yii2-jwt

JWT implementation for Yii2 Authorization process, (*1)

Installation

To install (only master is available now) run:, (*2)

    composer require "wilianto/yii2-jwt"

Or add this line to require section of composer.json:, (*3)

    "wilianto/yii2-jwt": "dev-master"

Usage

There is only one trait - UserTrait - which gives you 5 methods for authorization and JWT-management in User model, (*4)

Set up:, (*5)

In controller:, (*6)

<?php

// ...

use yii\filters\auth\HttpBearerAuth;

class BearerAuthController extends \yii\rest\ActiveController
{
    public function behaviors()
    {
        return array_merge(parent::behaviors(), [
            'bearerAuth' => [
                'class' => HttpBearerAuth::className()
            ]
        ]);
    }
}

In User model:, (*7)

<?php

// ...

use yii\db\ActiveRecord;
use yii\web\IdentityInterface

class User extends ActiveRecord implements IdentityInterface
{
    // Just use trait in User model, implement two abstract methods and that's
    // all you've got to do
    use \wilianto\JWT\UserTrait;

    // ...
}

The Versions

03/01 2016

dev-master

9999999-dev https://github.com/wilianto/yii2-jwt

Set of classes for easier JWT integration

  Sources   Download

MIT

The Requires

 

jwt yii auth0

09/11 2015

0.0.0

0.0.0.0 https://github.com/damirka/yii2-jwt

Set of classes for easier JWT integration

  Sources   Download

MIT

The Requires

 

jwt yii auth0