PHPackages                             zen0x7/tokenizer - 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. zen0x7/tokenizer

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

zen0x7/tokenizer
================

PHP SDK for Service Framework authentication and token generation.

1.0.2(1mo ago)022MITPHPPHP &gt;=8.1

Since Apr 27Pushed 1mo agoCompare

[ Source](https://github.com/Zen0x7/Tokenizer)[ Packagist](https://packagist.org/packages/zen0x7/tokenizer)[ RSS](/packages/zen0x7-tokenizer/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (3)DependenciesVersions (4)Used By (0)

Zen Tokenizer (PHP SDK)
=======================

[](#zen-tokenizer-php-sdk)

A high-performance PHP SDK for generating authenticated and encrypted JSON Web Tokens (JWT) for the Service Framework cluster.

Features
--------

[](#features)

- **JWE/JWS Support**: Fully compatible with the C++ implementation (AES-256-GCM + HMAC-SHA256).
- **Fluent Builder**: Easy token construction with a human-readable interface.
- **Grants &amp; Wildcards**: Full support for resource-based grants (`channels:*`, `cache:user.*`, `system:admin`).
- **Laravel Ready**: Easily integrable into any PHP 8.1+ project or framework.

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

[](#installation)

Install via Composer:

```
composer require zen0x7/tokenizer
```

Usage
-----

[](#usage)

### Generating a Token

[](#generating-a-token)

```
use Zen0x7\Tokenizer\TokenBuilder;

$builder = TokenBuilder::create()
    ->withSubject('user_123')
    ->withDuration(3600) // 1 hour
    ->withSystemPermissions(['admin', 'broadcast'])
    ->withChannelPermissions('chat.general', ['read', 'write'])
    ->withChannelPermissions('private.*', ['read'])
    ->withCachePermissions('user:profile:*', ['read', 'write', 'delete'])
    ->withClaim('custom_field', 'custom_value');

$token = $builder->build(
    signatureKey: 'base64:your_signature_key_here',
    encryptionKey: 'base64:your_encryption_key_here'
);

echo "Authorization: Bearer " . $token;
```

### Key Formats

[](#key-formats)

The SDK supports both raw binary keys and base64-encoded keys (prefixed with `base64:`).

```
// Example with base64 keys
$signatureKey = 'base64:c2VjcmV0X3NpZ25hdHVyZV9rZXlfZm9yX2V4YW1wbGVfdXNhZ2U=';
$encryptionKey = 'base64:YWVzXzI1Nl9nY21fZXhhbXBsZV9rZXlfMzJfYnl0ZXM=';
```

Security
--------

[](#security)

This SDK implements:

1. **JWS (JSON Web Signature)**: HMAC-SHA256 protecting the entire token.
2. **JWE (JSON Web Encryption)**: AES-256-GCM encrypting the payload.
3. **Base64Url**: Standard URL-safe encoding for JWT parts.

License
-------

[](#license)

MIT

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance91

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 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

Every ~0 days

Total

3

Last Release

43d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8731267?v=4)[Ian Torres](/maintainers/zen0x7)[@Zen0x7](https://github.com/Zen0x7)

---

Top Contributors

[![Zen0x7](https://avatars.githubusercontent.com/u/8731267?v=4)](https://github.com/Zen0x7 "Zen0x7 (5 commits)")

### Embed Badge

![Health badge](/badges/zen0x7-tokenizer/health.svg)

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

###  Alternatives

[kartik-v/yii2-password

Useful password strength validation utilities for Yii Framework 2.0

761.2M17](/packages/kartik-v-yii2-password)

PHPackages © 2026

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