PHP code example of hyperf-yfd / jwt
1. Go to this page and download the library: Download hyperf-yfd/jwt library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hyperf-yfd / jwt example snippets
declare(strict_types=1);
use HyperfExt\Jwt\Contracts\JwtFactoryInterface;
use HyperfExt\Jwt\Contracts\ManagerInterface;
class SomeClass
{
/**
* 提供了对 JWT 编解码、刷新和失活的能力。
*
* @var \HyperfExt\Jwt\Contracts\ManagerInterface
*/
protected $manager;
/**
* 提供了从请求解析 JWT 及对 JWT 进行一系列相关操作的能力。
*
* @var \HyperfExt\Jwt\Jwt
*/
protected $jwt;
public function __construct(
ManagerInterface $manager,
JwtFactoryInterface $jwtFactory
) {
$this->manager = $manager;
$this->jwt = $jwtFactory->make();
}
}
shell script
php bin/hyperf.php vendor:publish hyperf-yfd/jwt