Skip to content

Commit 373964c

Browse files
committed
Merge branch 'master' into develop
2 parents 40a75dd + d6a0f62 commit 373964c

File tree

4 files changed

+24
-8
lines changed

4 files changed

+24
-8
lines changed

CREDITS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
jwt
1+
JWT
2+
ZiHang Gao

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
<p><a target="_blank" href="https://jwt.io"><img src="https://jwt.io/img/logo-asset.svg" /></a></p>
33
<p>A PHP extension for <a target="_blank" href="https://tools.ietf.org/html/rfc7519">RFC 7519 OAuth JSON Web Token (JWT)</a></p>
44
<a target="_blank" href="https://travis-ci.org/cdoco/php-jwt" title="Build Status"><img src="https://travis-ci.org/cdoco/php-jwt.svg"></a>
5-
<img src="https://img.shields.io/badge/branch-master-brightgreen.svg?style=flat-square">
5+
<img src="https://img.shields.io/badge/PHP-%3E%3D7.0.0-blue.svg">
6+
<img src="https://img.shields.io/badge/OpenSSL-%3E%3D1.0.1f-blue.svg">
7+
<img src="https://img.shields.io/badge/branch-master-brightgreen.svg">
8+
<img src="https://img.shields.io/github/repo-size/cdoco/php-jwt.svg">
69
</div>
710

811
## Requirement
@@ -318,10 +321,10 @@ try {
318321
## Functions
319322

320323
```php
321-
//encode
322-
string jwt_encode(array $claims, string $key [, string $algorithm = 'HS256'])
324+
// encode
325+
string jwt_encode(array $payload, string $key [, string $algorithm = 'HS256'])
323326

324-
//decode
327+
// decode
325328
array jwt_decode(string $token, string $key [, array $options = ['algorithm' => 'HS256']])
326329
```
327330

jwt.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,18 @@ PHP_JWT_API zend_class_entry *jwt_invalid_sub_cex;
5050

5151
ZEND_DECLARE_MODULE_GLOBALS(jwt)
5252

53+
ZEND_BEGIN_ARG_INFO_EX(arginfo_jwt_encode, 0, 0, 2)
54+
ZEND_ARG_ARRAY_INFO(0, payload, 1)
55+
ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 1)
56+
ZEND_ARG_TYPE_INFO(0, alg, IS_STRING, 1)
57+
ZEND_END_ARG_INFO()
58+
59+
ZEND_BEGIN_ARG_INFO_EX(arginfo_jwt_decode, 0, 0, 2)
60+
ZEND_ARG_TYPE_INFO(0, token, IS_STRING, 1)
61+
ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 1)
62+
ZEND_ARG_INFO(0, options)
63+
ZEND_END_ARG_INFO()
64+
5365
/* string to algorithm */
5466
jwt_alg_t jwt_str_alg(const char *alg)
5567
{
@@ -618,8 +630,8 @@ PHP_FUNCTION(jwt_decode)
618630
}
619631

620632
const zend_function_entry jwt_functions[] = {
621-
PHP_FE(jwt_encode, NULL)
622-
PHP_FE(jwt_decode, NULL)
633+
PHP_FE(jwt_encode, arginfo_jwt_encode)
634+
PHP_FE(jwt_decode, arginfo_jwt_decode)
623635
PHP_FE_END
624636
};
625637

php_jwt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
extern zend_module_entry jwt_module_entry;
2525
#define phpext_jwt_ptr &jwt_module_entry
2626

27-
#define PHP_JWT_VERSION "0.2.1" /* Replace with version number for your extension */
27+
#define PHP_JWT_VERSION "0.2.2" /* Replace with version number for your extension */
2828

2929
#ifdef PHP_WIN32
3030
# define PHP_JWT_API __declspec(dllexport)

0 commit comments

Comments
 (0)