PHPackages                             ramosisw/cakephp-jwt-claims - 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. ramosisw/cakephp-jwt-claims

ActiveCakephp-component[Authentication &amp; Authorization](/categories/authentication)

ramosisw/cakephp-jwt-claims
===========================

CakePHP plugin for read claims on jwt token

1.0.0(8y ago)012MITPHPCI failing

Since May 4Pushed 8y ago1 watchersCompare

[ Source](https://github.com/ramosisw/cakephp-jwt-claims)[ Packagist](https://packagist.org/packages/ramosisw/cakephp-jwt-claims)[ Docs](http://github.com/ramosisw/cakephp-jwt-claims)[ RSS](/packages/ramosisw-cakephp-jwt-claims/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

cakephp-jwt-claims
==================

[](#cakephp-jwt-claims)

[![Build Status](https://camo.githubusercontent.com/dcab70443dd34c50bb61e45b093383030976edca93dfd42ee066fcdf4741022f/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f72616d6f736973772f63616b657068702d6a77742d636c61696d732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/ramosisw/cakephp-jwt-claims)[![Coverage](https://camo.githubusercontent.com/83222d15867ae15ed7fddcf53b59ca6af88bc0c484b4b53e4c2e9b22454643cf/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f72616d6f736973772f63616b657068702d6a77742d636c61696d732e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/github/ramosisw/cakephp-jwt-claims)[![Total Downloads](https://camo.githubusercontent.com/acc2466082c936fd9cef5a22a5bd0c82c7c9490f68cf155e4adb65f4ebbb1a96/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72616d6f736973772f63616b657068702d6a77742d636c61696d732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ramosisw/cakephp-jwt-claims)[![License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE.txt)

CakePHP 3.6+ Component to read claims of JWT on Authorization

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

[](#installation)

```
composer require ramosisw/cakephp-jwt-claims
```

Configuration:
--------------

[](#configuration)

Setup `ClaimsComponent`:

```
    // In your controller, for e.g. src/Controller/AppController.php
    public function initialize()
    {
        parent::initialize();
        //Config JWT with ADmad Plugin for more info see https://github.com/ADmad/cakephp-jwt-auth
        $this->loadComponent('Auth', [/*..*/]);
        //Load Claims component
        $this->loadComponent('RamosISW/Jwt.Claims',[
            'claims_key' => 'data', //name where is claims on JWT Payload
            //Wath claims be read
            'data' => [
                'user_id', 'user_email', 'user_name'
            ]
        ]);
    }
```

Working
-------

[](#working)

To read claims on route that user can access

```
    public function index(){
        //read user email sends on token
        $this->log($this->Claims->user_email);

        //set claims to use on view
        $this->set('Claims', $this->Claims);
    }
```

Token Generation
----------------

[](#token-generation)

You can use `\Firebase\JWT\JWT::encode()` of the [firebase/php-jwt](https://github.com/firebase/php-jwt)lib, which this plugin depends on, to generate tokens.

**The payload should have the "sub" (subject) claim whos value is used to query the Users model and find record matching the "id" field.**

**Generate Claims**

```
    public function generateToken($user){
        $token = \Firebase\JWT\JWT::encode([
                'sub' => $user['id'],
                'exp' => time() + 604800,
                'data' => [
                    'user_id' => $user['id'],
                    'user_email' => $user['email'],
                    'user_name' => $user['username']
                ]
        ], \Cake\Utility\Security::getSalt());

        return $token;
    }
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

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

2928d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7df27c7655457e94b93763e1e84513628af09975359ab7f985d801fd2decc36d?d=identicon)[ramosisw](/maintainers/ramosisw)

---

Top Contributors

[![JulioRamos0](https://avatars.githubusercontent.com/u/3371601?v=4)](https://github.com/JulioRamos0 "JulioRamos0 (24 commits)")

---

Tags

jwtAuthenticationcakephpauthenticateclaims

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ramosisw-cakephp-jwt-claims/health.svg)

```
[![Health](https://phpackages.com/badges/ramosisw-cakephp-jwt-claims/health.svg)](https://phpackages.com/packages/ramosisw-cakephp-jwt-claims)
```

###  Alternatives

[admad/cakephp-jwt-auth

CakePHP plugin for authenticating using JSON Web Tokens

160680.3k8](/packages/admad-cakephp-jwt-auth)[cakedc/users

Users Plugin for CakePHP

524897.0k16](/packages/cakedc-users)[dereuromark/cakephp-tinyauth

A CakePHP plugin to handle user authentication and authorization the easy way.

129228.6k10](/packages/dereuromark-cakephp-tinyauth)[cakedc/auth

Auth objects for CakePHP

31630.0k2](/packages/cakedc-auth)[dmkit/phalcon-jwt-auth

A simple JWT middleware for Phalcon Micro to handle stateless authentication

3541.5k](/packages/dmkit-phalcon-jwt-auth)[xety/cake3-cookieauth

A simple Cake3 plugin to authenticate users with Cookies.

1954.7k2](/packages/xety-cake3-cookieauth)

PHPackages © 2026

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