PHPackages                             siu-toba/jwt-util - 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. siu-toba/jwt-util

ActiveLibrary

siu-toba/jwt-util
=================

Una pequeña librería que autentica con Web Tokens JSON (JWT)

v2.1.0(2mo ago)187.3k↓33.3%[1 issues](https://github.com/SIU-Toba/jwt-util/issues)2PHPPHP &gt;=8.1.0

Since Jan 6Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/SIU-Toba/jwt-util)[ Packagist](https://packagist.org/packages/siu-toba/jwt-util)[ Docs](http://www.siu.edu.ar)[ RSS](/packages/siu-toba-jwt-util/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (4)Versions (12)Used By (2)

jwt-util
========

[](#jwt-util)

Esta librería encapsula la manipulación de tokens tipo JWT (). Permite generar y validar los tokens, utilizando para ello claves simétricas y/o asimétricas.

Requiere actualmente la librería [php-jwt](https://github.com/firebase/php-jwt).

Instalación
-----------

[](#instalación)

Usar composer para manejar las dependencias y descargar jwt-util:

```
composer require siu-toba/jwt-util
```

Generar un token
----------------

[](#generar-un-token)

Para generar un token o hacer el *encode* se debe elegir la encriptación, ya sea simétrica o asimétrica, definir una clave y un algoritmo.

```
    $keySimetrica = 'test';

    $datos = ['uid'=>'id-usuario', 'name'=>'usuario de prueba'];

    $simetricEncoder = new SimetricEncoder(Util::ALG_HS512, $keySimetrica, $datos);

    $jwt->setEncoder($simetricEncoder);

    $token = $jwt->encode();

    echo $token;
    // eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJ1aWQiOjEyMzQ1NiwibmFtZSI6Im15IHVzZXIgbmFtZSJ9.RZcDtMfrzoVEISsVYsVz11-rZ87rWqS7RHYctQnpZKDt8m8YsVZysh9Hu0OpDnPT-8JjHbWS_Xkz6Am11UAulQ
```

Validar un token
----------------

[](#validar-un-token)

También, es posible a partir del token y la clave, validar o hacer el *decode*y determinar si es un token válido, para así extraer la información relacionada.

```
    $keySimetrica = 'test';

    $simetricDecoder = new SimetricDecoder(Util::ALG_HS512, $keySimetrica);

    $this->jwt->setDecoder($simetricDecoder);

    // con el token generado previamente...
    $data = $this->jwt->decode($token);

    echo $data->uid;     // 'id-usuario'

    echo $data->name;    // 'usuario de prueba'
```

Opciones
--------

[](#opciones)

Los algoritmos y métodos soportados son:

algoritmométodo encode/decodeHS256simétricoHS384simétricoHS512simétricoRS256asimétricoRS512asimétricoPara generar tokens con el método asimétrico, se requieren de claves público/privadas. Se puede generar algunas de prueba de la siguiente forma:

```
    openssl genrsa 512 > server.key
    openssl rsa -pubout  server.pem
```

Nota: esto genera claves para RS256, para RS512 usar `genrsa 1024`

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance65

Regular maintenance activity

Popularity31

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 52% 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 ~417 days

Recently: every ~261 days

Total

9

Last Release

84d ago

Major Versions

v1.1.0 → v2.0.02025-06-11

PHP version history (3 changes)v1.0.0PHP &gt;=5.6.0

v1.0.5PHP &gt;=7.1.0

v1.1.0PHP &gt;=8.1.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/113a580f9c74020bd76fae1460f3547da2ce97081ca9857dcc0588bd151b1904?d=identicon)[siutoba](/maintainers/siutoba)

---

Top Contributors

[![sergiovier](https://avatars.githubusercontent.com/u/286618?v=4)](https://github.com/sergiovier "sergiovier (13 commits)")[![enfoqueNativo](https://avatars.githubusercontent.com/u/12297079?v=4)](https://github.com/enfoqueNativo "enfoqueNativo (11 commits)")[![andres-blanco](https://avatars.githubusercontent.com/u/375980?v=4)](https://github.com/andres-blanco "andres-blanco (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/siu-toba-jwt-util/health.svg)

```
[![Health](https://phpackages.com/badges/siu-toba-jwt-util/health.svg)](https://phpackages.com/packages/siu-toba-jwt-util)
```

###  Alternatives

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k96.9M674](/packages/laravel-socialite)[laravel/passport

Laravel Passport provides OAuth2 server support to Laravel.

3.4k85.0M532](/packages/laravel-passport)[google/auth

Google Auth Library for PHP

1.4k272.7M162](/packages/google-auth)[kreait/firebase-php

Firebase Admin SDK

2.4k39.7M72](/packages/kreait-firebase-php)[shopify/shopify-api

Shopify API Library for PHP

4634.8M16](/packages/shopify-shopify-api)[thenetworg/oauth2-azure

Azure Active Directory OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2509.6M48](/packages/thenetworg-oauth2-azure)

PHPackages © 2026

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