PHPackages                             lcobucci/jose-parsing - 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. lcobucci/jose-parsing

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

lcobucci/jose-parsing
=====================

A basic Base64Url and JSON encoding/decoding implementation

3.0.0(5y ago)26550.6k—6.3%23BSD-3-ClausePHPPHP ^7.4 || ^8.0

Since Sep 11Pushed 5y agoCompare

[ Source](https://github.com/lcobucci/jose-parsing)[ Packagist](https://packagist.org/packages/lcobucci/jose-parsing)[ GitHub Sponsors](https://github.com/lcobucci)[ Patreon](https://www.patreon.com/lcobucci)[ RSS](/packages/lcobucci-jose-parsing/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (8)Versions (13)Used By (3)

Javascript Object Signing and Encoding Parsing
==============================================

[](#javascript-object-signing-and-encoding-parsing)

[![Gitter](https://camo.githubusercontent.com/82b37b704e2e79c5d50f45f6cf0aab5873f32ffcca6c38864d72b1a66c2ba48c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4749545445522d4a4f494e253230434841542532302545322538362539322d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://gitter.im/lcobucci/jose-parsing?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)[![Total Downloads](https://camo.githubusercontent.com/8a294f37f6867aafb0c48b34ee7516bf72ff7545d6a3234d070b60e16ba83912/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c636f62756363692f6a6f73652d70617273696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lcobucci/jose-parsing)[![Latest Stable Version](https://camo.githubusercontent.com/c73f2813dd3b6c46732106497ebcc1d3be596add30ad68bad4493ad4fcfb564c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c636f62756363692f6a6f73652d70617273696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lcobucci/jose-parsing)

[![Branch master](https://camo.githubusercontent.com/d13ff590538bd288fc9f75cbfe383af4eaaaa0c356f9e90aed2263bb322bd87f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6272616e63682d6d61737465722d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/d13ff590538bd288fc9f75cbfe383af4eaaaa0c356f9e90aed2263bb322bd87f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6272616e63682d6d61737465722d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)[![Build Status](https://camo.githubusercontent.com/f351923cb89d2dc354a8c77caf54169e31aa0f5ae732a38e770934e4fc98f931/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f6d2f6c636f62756363692f6a6f73652d70617273696e672f6d61737465722e7376673f7374796c653d666c61742d737175617265)](http://travis-ci.com/lcobucci/jose-parsing)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/347b742d3a046280c9221cc22540db516e3ac1dc49a16ff5a62cf0ec220e7d47/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6c636f62756363692f6a6f73652d70617273696e672f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/lcobucci/jose-parsing/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/d83cc3b379180633e9faaaa822f0515ee3c7745314f9afc2ab89bdfa35a12247/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6c636f62756363692f6a6f73652d70617273696e672f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/lcobucci/jose-parsing/?branch=master)[![SensioLabsInsight](https://camo.githubusercontent.com/5d78ba8f28606b447842ad95564ac2e48d5fe088da91ed8967714f5be5fa0b75/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f66663462333435342d373761652d343838322d383935352d3063353563356365356336382f6d696e692e706e67)](https://insight.sensiolabs.com/projects/ff4b3454-77ae-4882-8955-0c55c5ce5c68)

A base64Url and JSON encoding/decoding implementation.

Installation
------------

[](#installation)

Package is available on [Packagist](http://packagist.org/packages/lcobucci/jose-parsing), you can install it using [Composer](http://getcomposer.org).

```
composer require lcobucci/jose-parsing
```

Usage
-----

[](#usage)

You probably won't need to depend on this library directly. However, feel free to use its base64url and JSON (with some extra validation) encoding/decoding.

### Encoding

[](#encoding)

```
use Lcobucci\Jose\Parsing\Parser;

$bilboQuote = "It’s a dangerous business, Frodo, going out your door. You step "
            . "onto the road, and if you don't keep your feet, there’s no knowing "
            . "where you might be swept off to.";

$encoder = new Parser();
echo $encoder->jsonEncode(['testing' => 'test']); // {"testing":"test"}
echo $encoder->base64UrlEncode($bilboQuote);

/*
  That quote is used in RFC 7520 example (in UTF-8 encoding, sure),
  and the output is (line breaks added for readbility):

  SXTigJlzIGEgZGFuZ2Vyb3VzIGJ1c2luZXNzLCBGcm9kbywgZ29pbmcgb3V0IHlvdXIgZG9vci4gWW
  91IHN0ZXAgb250byB0aGUgcm9hZCwgYW5kIGlmIHlvdSBkb24ndCBrZWVwIHlvdXIgZmVldCwgdGhl
  cmXigJlzIG5vIGtub3dpbmcgd2hlcmUgeW91IG1pZ2h0IGJlIHN3ZXB0IG9mZiB0by4
 */
```

### Decoding

[](#decoding)

```
use Lcobucci\Jose\Parsing\Parser;

$bilboQuote = "SXTigJlzIGEgZGFuZ2Vyb3VzIGJ1c2luZXNzLCBGcm9kbywgZ29pbmcgb3V0IHlvdXIgZG9vci4gWW"
            . "91IHN0ZXAgb250byB0aGUgcm9hZCwgYW5kIGlmIHlvdSBkb24ndCBrZWVwIHlvdXIgZmVldCwgdGhl"
            . "cmXigJlzIG5vIGtub3dpbmcgd2hlcmUgeW91IG1pZ2h0IGJlIHN3ZXB0IG9mZiB0by4";

$decoder = new Parser();
var_dump($decoder->jsonDecode('{"testing":"test"}')); // object(stdClass)#1 (1) { ["testing"] => string(4) "test" }
echo $decoder->base64UrlDecode($bilboQuote);

/*
  The output would be the same as the quote used in previous example:

  "It’s a dangerous business, Frodo, going out your door. You step "
  "onto the road, and if you don't keep your feet, there’s no knowing "
  "where you might be swept off to."
 */
```

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity44

Moderate usage in the ecosystem

Community14

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 90.9% 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

Every ~245 days

Recently: every ~417 days

Total

8

Last Release

2188d ago

Major Versions

1.0.x-dev → 2.0.02015-10-28

2.2.0 → 3.0.02020-05-22

PHP version history (4 changes)1.0.0PHP &gt;=5.5

2.0.0PHP ~7.0

2.2.0PHP ^7.1

3.0.0PHP ^7.4 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/201963?v=4)[Luís Cobucci](/maintainers/lcobucci)[@lcobucci](https://github.com/lcobucci)

---

Top Contributors

[![lcobucci](https://avatars.githubusercontent.com/u/201963?v=4)](https://github.com/lcobucci "lcobucci (50 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (5 commits)")

---

Tags

decodingencodingjosejsonjwtphpJOSEbase64url

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[web-token/jwt-framework

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

94818.9M77](/packages/web-token-jwt-framework)[kelvinmo/simplejwt

A simple JSON Web Token library for PHP.

701.1M14](/packages/kelvinmo-simplejwt)[web-token/jwt-library

JWT library

2011.2M83](/packages/web-token-jwt-library)[spomky-labs/lexik-jose-bridge

Bridge to allow the use of web-token/jwt-framework with the Lexik JWT Authentication Bundle

35444.0k](/packages/spomky-labs-lexik-jose-bridge)[web-token/jwt-bundle

JWT Bundle of the JWT Framework.

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

A PHP library for JSON web tokens (JWT) with signature (JWS) and encryption (JWE) support.

26257.5k1](/packages/sop-jwx)

PHPackages © 2026

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