不使用Composer安装vendor扩展包
1、直接在 git地址 下载 源码包,解压到\vendor\firebase这个位置
具体:\vendor\firebase\JWT\src\JWT.php
2、控制器代码引用
不使用Composer安装,不能直接引用的,所以用下面这种方法引用
require_once '../vendor/Firebase/JWT/BeforeValidException.php';
require_once '../vendor/Firebase/JWT/ExpiredException.php';
require_once '../vendor/Firebase/JWT/SignatureInvalidException.php';
require_once '../vendor/Firebase/JWT/JWT.php';
use \Firebase\JWT\JWT;
$key = "example_key";
$token = array(
"iss" => "http://example.org",
"aud" => "http://example.com",
"iat" => 1356999524,
"nbf" => 1357000000
);
/**
* IMPORTANT:
* You must specify supported algorithms for your application. See
* https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40
* for a list of spec-compliant algorithms.
*/
$jwt = JWT::encode($token, $key);
$decoded = JWT::decode($jwt, $key, array('HS256'));
使用Composer安装,会在\vendor\composer\installed.json中注册,会写入相关扩展包的信息