PHPackages                             jcarrillocallao/jose - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. jcarrillocallao/jose

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

jcarrillocallao/jose
====================

JSON Object Signing and Encryption library for PHP.

1.0.0(2y ago)1321MITPHPPHP &gt;=7.4

Since Aug 9Pushed 2y agoCompare

[ Source](https://github.com/jcarrillocallao/jose)[ Packagist](https://packagist.org/packages/jcarrillocallao/jose)[ Docs](https://github.com/Spomky-Labs/Jose)[ RSS](/packages/jcarrillocallao-jose/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (12)Versions (2)Used By (0)

PHP JOSE Library
================

[](#php-jose-library)

If you really love that library, then you can help me out for a couple of 🍻!

[![Beerpay](https://camo.githubusercontent.com/2e90971a5287f05c7863699c2c6fe0949f80626e2b24f08ca39d7ea28b4f4ed6/68747470733a2f2f626565727061792e696f2f53706f6d6b792d4c6162732f6a6f73652f62616467652e7376673f7374796c653d626565722d737175617265)](https://beerpay.io/Spomky-Labs/jose) [![Beerpay](https://camo.githubusercontent.com/2263072485f7de6c977366b4e4e0adc7879065c20cdc9b6d86effd8bdf4cd970/68747470733a2f2f626565727061792e696f2f53706f6d6b792d4c6162732f6a6f73652f6d616b652d776973682e7376673f7374796c653d666c61742d737175617265)](https://beerpay.io/Spomky-Labs/jose?focus=wish)

---

⚠️⚠️⚠️

We highly recommend you to use the new [JWT Framework project](https://github.com/web-token/jwt-framework) instead of this library.

- Active support of this library is provided until **end of 2018**.
- Security support will be provided **from 2019 and up to end of 2020**.

A migration guide will be/is available in [the documentation of the new project](https://web-token.spomky-labs.com/v/v1.x/migration).

⚠️⚠️⚠️

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/fbfdd771056d594bb05e7bc0fc3e522bd4f02022489c75a2e5ea2f30a5a1eea6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f53706f6d6b792d4c6162732f6a6f73652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Spomky-Labs/jose/?branch=master)[![Coverage Status](https://camo.githubusercontent.com/f27103e7729b59a7b3c5a4d310e34e397b8bcec435a70808d6705ed737ea38c6/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f53706f6d6b792d4c6162732f6a6f73652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/Spomky-Labs/jose?branch=master)

[![Build Status](https://camo.githubusercontent.com/f17681f13e4cd1535772db0ed1b7b210d9f255f7448aff9125772676238f62f5/68747470733a2f2f7472617669732d63692e6f72672f53706f6d6b792d4c6162732f6a6f73652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Spomky-Labs/jose)[![HHVM Status](https://camo.githubusercontent.com/171dfbc7063d6425d246a8174407ba9061bfe463f0b9946f7643d6f168ead915/687474703a2f2f6868766d2e683463632e64652f62616467652f53706f6d6b792d4c6162732f6a6f73652e7376673f7374796c653d666c6174)](http://hhvm.h4cc.de/package/Spomky-Labs/jose)[![PHP 7 ready](https://camo.githubusercontent.com/5639807d3e891cdfa6fcc8df016e815e991c7daf2aa27319eaa53091b580dbde/687474703a2f2f7068703772656164792e74696d6573706c696e7465722e63682f53706f6d6b792d4c6162732f6a6f73652f62616467652e737667)](https://travis-ci.org/Spomky-Labs/jose)

[![Dependency Status](https://camo.githubusercontent.com/511b26f45e83871682e469c62322668ad63545b182edf59c9147fb440ccb1b8f/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3537616332386334383961393734303033346361313863362f62616467652e7376673f7374796c653d666c61742d737175617265)](https://www.versioneye.com/user/projects/57ac28c489a9740034ca18c6)

[![SensioLabsInsight](https://camo.githubusercontent.com/060275648c3c4166451333483c7ac67a66868e7c2b75d63b3010e3f9c17715da/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f39313233666266632d376165312d346436332d396664612d3137306238616437393465652f6269672e706e67)](https://insight.sensiolabs.com/projects/9123fbfc-7ae1-4d63-9fda-170b8ad794ee)

[![Latest Stable Version](https://camo.githubusercontent.com/d1701045b154ff488ebef7c361e004e95e225cd71e5bb33852f85ea3590ad4c3/68747470733a2f2f706f7365722e707567782e6f72672f53706f6d6b792d4c6162732f4a4f53452f762f737461626c652e706e67)](https://packagist.org/packages/Spomky-Labs/JOSE)[![Total Downloads](https://camo.githubusercontent.com/8e94f962a768937f63ed07acd24650e20cb5396bf952443f505d3d57cbb3c421/68747470733a2f2f706f7365722e707567782e6f72672f53706f6d6b792d4c6162732f4a4f53452f646f776e6c6f6164732e706e67)](https://packagist.org/packages/Spomky-Labs/JOSE)[![Latest Unstable Version](https://camo.githubusercontent.com/74790cfe19b2391fc5eea736767502355194a53438cfcdfd5ab79f3ac8243504/68747470733a2f2f706f7365722e707567782e6f72672f53706f6d6b792d4c6162732f4a4f53452f762f756e737461626c652e706e67)](https://packagist.org/packages/Spomky-Labs/JOSE)[![License](https://camo.githubusercontent.com/e672e8f54479de0f3586acc5517399dd9d726d8733491a8bee512bf710fded70/68747470733a2f2f706f7365722e707567782e6f72672f53706f6d6b792d4c6162732f4a4f53452f6c6963656e73652e706e67)](https://packagist.org/packages/Spomky-Labs/JOSE)

This library provides an implementation of:

- JW**S** [JSON Web Signature (RFC 7515)](https://tools.ietf.org/html/rfc7515),
- JW**T** [JSON Web Token (RFC 7519)](https://tools.ietf.org/html/rfc7519),
- JW**E** [JSON Web Encryption (RFC 7516)](http://tools.ietf.org/html/rfc7516),
- JW**A** [JSON Web Algorithms (RFC 7518)](http://tools.ietf.org/html/rfc7518).
- JW**K** [JSON Web Key (RFC 7517)](http://tools.ietf.org/html/rfc7517).
- JSON Web Key Thumbprint ([RFC 7638](https://tools.ietf.org/html/rfc7638)).
- Unencoded Payload Option [RFC7797](https://tools.ietf.org/html/rfc7797).

Provided Features
=================

[](#provided-features)

Supported Input Types:
----------------------

[](#supported-input-types)

JWS or JWE objects support every input that can be encoded into JSON:

- `string`, `array`, `integer`, `float`...
- Objects that implement the `\JsonSerializable` interface such as `JWKInterface` or `JWKSetInterface`

The [detached content](https://tools.ietf.org/html/rfc7515#appendix-F) is also supported.

Unencoded payload is supported. This means you can sign and verify payload without base64 encoding operation. As per the [RFC7797](https://tools.ietf.org/html/rfc7797), the `b64` header MUST be protected. When `b64` header is set, the `crit` protected header with value `b64` in its array of values is mandatory.

Supported Serialization Modes
-----------------------------

[](#supported-serialization-modes)

- Compact JSON Serialization Syntax (JWS/JWE creation and loading)
- Flattened JSON Serialization Syntax (JWS/JWE creation and loading)
- General JSON Serialization Syntax (JWS/JWE creation and loading)

Supported Compression Methods
-----------------------------

[](#supported-compression-methods)

Compression MethodSupportedCommentDeflate (`DEF`)YESGZip (`GZ`)YES*This compression method is not described in the specification*ZLib (`ZLIB`)YES*This compression method is not described in the specification*Supported Key Types (JWK)
-------------------------

[](#supported-key-types-jwk)

Key TypeSupportedComment`none`YESNone keys are for the `none` algorithm only`oct`YESSymmetric keys`RSA`YESRSA based asymmetric keys`EC`YESElliptic Curves based asymmetric keys`OKP`YESOctet Key Pair based asymmetric keysJWK objects support JSON Web Key Thumbprint ([RFC 7638](https://tools.ietf.org/html/rfc7638)).

Key Sets (JWKSet)
-----------------

[](#key-sets-jwkset)

JWKSet is fully supported.

Supported Signature Algorithms
------------------------------

[](#supported-signature-algorithms)

Signature AlgorithmSupportedComment`HS256`, `HS384` and `HS512`YES`HS256`, `ES384` and `ES512`YES`RS256`, `RS384` and `RS512`YES`PS256`, `PS384` and `PS512`YES`none`YES**Please note that this is not a secured algorithm. USE IT WITH CAUTION!***`EdDSA` with `Ed25519` curve*YES[Third party extension required](https://github.com/encedo/php-ed25519-ext)*`EdDSA` with `Ed448` curve***NO***Please note that the [EdDSA signature algorithm specification](https://tools.ietf.org/html/draft-ietf-jose-cfrg-curves)is not not yet approved. Support for algorithms `Ed25518` and `Ed448` may change. Use with caution.*

Supported Key Encryption Algorithms
-----------------------------------

[](#supported-key-encryption-algorithms)

Key Encryption AlgorithmSupportedComment`dir`YES`RSA1_5`, `RSA-OAEP` and `RSA-OAEP-256`YES`ECDH-ES`, `ECDH-ES+A128KW`, `ECDH-ES+A192KW` and `ECDH-ES+A256KW`YES`A128KW`, `A128KW` and `A128KW`YES`PBES2-HS256+A128KW`, `PBES2-HS384+A192KW` and `PBES2-HS512+A256KW`YES`A128GCMKW`, `A192GCMKW` and `A256GCMKW`YESFor better performance, please use PHP 7.1+ or this [third party extension ](https://github.com/bukka/php-crypto)`EdDSA` with `X25519` curveYES[Third party extension required](https://github.com/encedo/php-curve25519-ext)`EdDSA` with `X448` curve**NO***Please note that the [EdDSA encryption algorithm specification](https://tools.ietf.org/html/draft-ietf-jose-cfrg-curves)is not not yet approved. Support for algorithms `X25518` and `X448` may change. Use with caution.*

Supported Content Encryption Algorithms
---------------------------------------

[](#supported-content-encryption-algorithms)

Content Encryption AlgorithmSupportedComment`A128CBC-HS256`, `A192CBC-HS384` and `A256CBC-HS512`YES`A128GCM`, `A192GCM` and `A256GCM`YESFor better performance, please use PHP 7.1+ or this [third party extension](https://github.com/bukka/php-crypto)The Release Process
===================

[](#the-release-process)

The release process [is described here](doc/Release.md).

Prerequisites
=============

[](#prerequisites)

This library needs at least:

- [![PHP 7.0+](https://camo.githubusercontent.com/82038f17737bfd04512c70e840f76a51cb29038520c86d618eac3787da60e49d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e302532422d6666363962342e737667)](https://camo.githubusercontent.com/82038f17737bfd04512c70e840f76a51cb29038520c86d618eac3787da60e49d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e302532422d6666363962342e737667),
- OpenSSL extension.

Please consider the following optional requirements:

- For AES-GCM based algorithms (`AxxxGCM` and `AxxxGCMKW`) if not on PHP 7.1+: [PHP Crypto](https://github.com/bukka/php-crypto) Extension (at least `v0.2.1`) is highly recommended as encryption/decryption is faster than the pure PHP implementation.
- For Ed25519 algorithm: [php-ed25519-ext](https://github.com/encedo/php-ed25519-ext) required
- For X25519 algorithm: [php-curve25519-ext](https://github.com/encedo/php-curve25519-ext) required

Please read performance test results below concerning the ECC based algorithms. As the time needed to perform operation is long compared to the other algorithms, we do not recommend their use.

Continuous Integration
======================

[](#continuous-integration)

It has been successfully tested using `PHP 7.0`, `PHP 7.1` and `PHP7.2` with all algorithms. If you use PHP 5.6, please install the version ^6.0 of this project.

Tests vectors from the [RFC 7520](http://tools.ietf.org/html/rfc7520) are fully implemented and all tests pass.

We also track bugs and code quality using [Scrutinizer-CI](https://scrutinizer-ci.com/g/Spomky-Labs/JOSE) and [Sensio Insight](https://insight.sensiolabs.com/projects/9123fbfc-7ae1-4d63-9fda-170b8ad794ee).

Coding Standards are verified by [StyleCI](https://styleci.io/repos/22874677).

Code coverage is analyzed by [Coveralls.io](https://coveralls.io/github/Spomky-Labs/jose).

Installation
============

[](#installation)

The preferred way to install this library is to rely on Composer:

```
composer require spomky-labs/jose
```

How to use
==========

[](#how-to-use)

Have a look at [How to use](doc/Use.md) to know how to load your JWT and discover all possibilities provided by this library.

Performances
============

[](#performances)

Please read the [performance page](doc/Performance.md) to know how fast are the algorithms supported by this library.

Contributing
============

[](#contributing)

Requests for new features, bug fixed and all other ideas to make this library useful are welcome. If you feel comfortable writting code, you could try to fix [opened issues where help is wanted](https://github.com/Spomky-Labs/jose/labels/help+wanted) or [those that are easy to fix](https://github.com/Spomky-Labs/jose/labels/easy-pick).

Do not forget to [follow these best practices](doc/Contributing.md).

Licence
=======

[](#licence)

This software is release under [MIT licence](LICENSE).

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1007d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f4a2e57c9f01fc0443bcd81904a9d57356dfdf4f05d934f482cad66662f3aea7?d=identicon)[jcarrillocallao](/maintainers/jcarrillocallao)

---

Top Contributors

[![Spomky](https://avatars.githubusercontent.com/u/1091072?v=4)](https://github.com/Spomky "Spomky (251 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (12 commits)")[![mdeboer](https://avatars.githubusercontent.com/u/1171956?v=4)](https://github.com/mdeboer "mdeboer (2 commits)")[![nubs](https://avatars.githubusercontent.com/u/57673?v=4)](https://github.com/nubs "nubs (2 commits)")[![jeroennoten](https://avatars.githubusercontent.com/u/4370753?v=4)](https://github.com/jeroennoten "jeroennoten (1 commits)")[![lamungu](https://avatars.githubusercontent.com/u/3449682?v=4)](https://github.com/lamungu "lamungu (1 commits)")[![psafont](https://avatars.githubusercontent.com/u/5189409?v=4)](https://github.com/psafont "psafont (1 commits)")[![ragboyjr](https://avatars.githubusercontent.com/u/1975857?v=4)](https://github.com/ragboyjr "ragboyjr (1 commits)")[![symm](https://avatars.githubusercontent.com/u/69390?v=4)](https://github.com/symm "symm (1 commits)")[![amenk](https://avatars.githubusercontent.com/u/1087128?v=4)](https://github.com/amenk "amenk (1 commits)")[![xelber](https://avatars.githubusercontent.com/u/1886444?v=4)](https://github.com/xelber "xelber (1 commits)")[![fkupper](https://avatars.githubusercontent.com/u/10757561?v=4)](https://github.com/fkupper "fkupper (1 commits)")[![gitter-badger](https://avatars.githubusercontent.com/u/8518239?v=4)](https://github.com/gitter-badger "gitter-badger (1 commits)")[![jcarrillocallao](https://avatars.githubusercontent.com/u/141864002?v=4)](https://github.com/jcarrillocallao "jcarrillocallao (1 commits)")

---

Tags

jwtJWSJWEJOSEjwaJWKJWKSetJotRFC7515RFC7516RFC7517RFC7518RFC7519RFC7520

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jcarrillocallao-jose/health.svg)

```
[![Health](https://phpackages.com/badges/jcarrillocallao-jose/health.svg)](https://phpackages.com/packages/jcarrillocallao-jose)
```

###  Alternatives

[web-token/jwt-framework

JSON Object Signing and Encryption library for PHP and Symfony Bundle.

94518.9M77](/packages/web-token-jwt-framework)[web-token/jwt-library

JWT library

2011.2M83](/packages/web-token-jwt-library)[web-token/jwt-bundle

JWT Bundle of the JWT Framework.

132.5M7](/packages/web-token-jwt-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
