PHPackages                             crudjt/crudjt-php - 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. crudjt/crudjt-php

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

crudjt/crudjt-php
=================

Fast B-tree–backed token store for stateful sessions

v1.0.0(2mo ago)09↓90%MITPHPCI passing

Since Mar 18Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/crudjt/crudjt-php)[ Packagist](https://packagist.org/packages/crudjt/crudjt-php)[ Docs](https://github.com/crudjt/crudjt-php)[ Patreon](https://www.patreon.com/crudjt)[ RSS](/packages/crudjt-crudjt-php/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (4)Versions (3)Used By (0)

    ![Shows a dark logo](https://raw.githubusercontent.com/crudjt/crudjt/refs/heads/master/logos/crudjt_logo_dark.png)
 PHP SDK for the fast, file-backed, scalable JSON token engine

 [ ![Buy Me a Coffee](https://raw.githubusercontent.com/crudjt/crudjt/refs/heads/master/logos/buy_me_a_coffee_orange.svg) ](https://www.patreon.com/crudjt)

[Escape the JWT trap: predictable login, safe logout](https://medium.com/@CoffeeMainer/jwt-trap-login-logout-under-control-9f3116d1db1d)

Fast B-tree–backed token store for stateful user sessions
Provides authentication and authorization across multiple processes
Optimized for vertical scaling on a single server

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

[](#installation)

Composer:

```
composer require crudjt/crudjt-php
```

Start CRUDJT master (once)
--------------------------

[](#start-crudjt-master-once)

`startMaster()` runs the master in a single PHP process

For multi-process or distributed setups, start the master in
[another supported runtime](https://github.com/crudjt/crudjt?tab=readme-ov-file#getting-started)
and connect from PHP using `connectToMaster()`or jump to [Start CRUDJT master in Docker](#start-crudjt-master-in-docker)

Start CRUDJT master
-------------------

[](#start-crudjt-master)

Start the CRUDJT master when your application boots

Only **one process** can do this for a **single token storage**

The master is responsible for session state
All functions can also be used directly from it

### Generate a new secret key (terminal)

[](#generate-a-new-secret-key-terminal)

```
export CRUDJT_SECRET_KEY=$(openssl rand -base64 48)
```

### Start master (php)

[](#start-master-php)

```
