PHPackages                             byjg/jwt-session - 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. byjg/jwt-session

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

byjg/jwt-session
================

A PHP session replacement that stores session data in JWT tokens instead of the filesystem. This implementation follows the SessionHandlerInterface standard, enabling stateless sessions without the need for dedicated session servers like Redis or Memcached. Perfect for distributed applications and microservices architectures.

6.0.0(5mo ago)5077.5k—0.8%13[2 issues](https://github.com/byjg/php-jwt-session/issues)MITPHPPHP &gt;=8.3 &lt;8.6CI passing

Since May 27Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/byjg/php-jwt-session)[ Packagist](https://packagist.org/packages/byjg/jwt-session)[ RSS](/packages/byjg-jwt-session/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (3)Versions (10)Used By (0)

   sidebar\_key jwt-session   tags    php

 cryptography

 authentication

    JWT Session Handler
===================

[](#jwt-session-handler)

A PHP session replacement that stores session data in JWT tokens instead of the filesystem. This implementation follows the SessionHandlerInterface standard, enabling stateless sessions without the need for dedicated session servers like Redis or Memcached. Perfect for distributed applications and microservices architectures.

[![Sponsor](https://camo.githubusercontent.com/fab14b7f7f475072ada0473f193d6f322561fd4a2958e0cc89910d053347cf27/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53706f6e736f722d2532336561346161613f6c6f676f3d67697468756273706f6e736f7273266c6f676f436f6c6f723d7768697465266c6162656c436f6c6f723d306431313137)](https://github.com/sponsors/byjg)[![Build Status](https://github.com/byjg/jwt-session/actions/workflows/phpunit.yml/badge.svg?branch=master)](https://github.com/byjg/jwt-session/actions/workflows/phpunit.yml)[![Opensource ByJG](https://camo.githubusercontent.com/425c1bbccc0f292bf4d20569ae74a6b2e384fd648f1af8911bc61de9a8dcfc0b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6f70656e736f757263652d62796a672d737563636573732e737667)](http://opensource.byjg.com)[![GitHub source](https://camo.githubusercontent.com/88e61eb211719144efdd570290a0456b6e13099c2df8d973f1bb43fe33bf0039/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4769746875622d736f757263652d696e666f726d6174696f6e616c3f6c6f676f3d676974687562)](https://github.com/byjg/jwt-session/)[![GitHub license](https://camo.githubusercontent.com/ef4027249a47e51772f513907d50e410c22ae8f90a4b9c33c3022a08ee78045c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f62796a672f6a77742d73657373696f6e2e737667)](https://opensource.byjg.com/opensource/licensing.html)[![GitHub release](https://camo.githubusercontent.com/cd7fdd517f6f183394d676c0669eb61984e6a8926c39cdce906cf2a6254a7dc3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f62796a672f6a77742d73657373696f6e2e737667)](https://github.com/byjg/jwt-session/releases/)

Documentation
-------------

[](#documentation)

- [Getting Started](docs/getting-started.md) - Installation, basic usage, and motivation
- [Configuration](docs/configuration.md) - Session timeout, contexts, cookies, and all configuration options
- [RSA Keys](docs/rsa-keys.md) - Using RSA private/public keys for enhanced security
- [How It Works](docs/how-it-works.md) - Architecture and internal implementation details
- [Security](docs/security.md) - Security considerations and best practices
- [API Reference](docs/api-reference.md) - Complete API documentation for all classes and methods

How to use:
===========

[](#how-to-use)

Before the session\_start() use the command:

```
