1 Star 5 Fork 0

Eric-Nothing / jwt

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

System Requirements

To build it you need the following requirements:

  • g++ >= 4.4/clang++ >= 3.x/vc++ 9
  • gnu make 3.81 or later
  • autoconf 2.31 or later
  • automake 1.14 or later
  • PHP development headers and tools

If you're using Ubuntu, you can install the required packages this way:

sudo apt-get update
sudo apt-get install git gcc make re2c php7 php7-json php7-dev libpcre3-dev

Installation

You can build extension and install it like:

git clone https://gitee.com/EricNothing/jwt.git
cd ext
./install

Edit your php.ini file and add this line:

extension=jwt.so

Don't forget to restart your php-fpm:

sudo service php7-fpm restart

Example

<?php

$key = "example_key";
$token = array(
    "iss" => "http://example.org",
    "aud" => "http://example.com",
    "iat" => 1356999524,
    "nbf" => 1357000000
);

$jwt = JWT\Token::encode($token, $key);
$decoded = JWT\Token::decode($jwt, $key, ['HS256']);

print_r($decoded);

JWT\Token::$leeway = 60; // $leeway in seconds
$decoded = JWT\Token::decode($jwt, $key, ['HS256']);

Reference

https://github.com/firebase/php-jwt

MIT License Copyright (c) 2020 Eric-Nothing Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Develop php-jwt extension with zephir 展开 收起
Zephir
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Zephir
1
https://gitee.com/EricNothing/jwt.git
git@gitee.com:EricNothing/jwt.git
EricNothing
jwt
jwt
master

搜索帮助