Search by

stougeiro / session-contract

stougeiro

Minimal, framework‑agnostic session and flash message contracts for PHP applications. Designed for both traditional PHP‑FPM and Swoole servers, enabling pluggable, storage‑independent session handling with zero friction.

Package info

github.com/stougeiro/session-contract

pkg:composer/stougeiro/session-contract

Fund package maintenance!

Buymeacoffee

Statistics

Installs: 9

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v4.0.0 2026-09-15 20:16 UTC

This package is auto-updated.

Last update: 2026-09-15 20:17:37 UTC


README

PHP PHPStan-Level License

Session Contract

Minimal, framework‑agnostic interfaces for handling session data and flash messages in PHP. Designed to work seamlessly in both traditional PHP‑FPM environments and persistent servers like Swoole, enabling pluggable, storage‑independent session handling with zero friction.

✨ Features

  • Essential interfaces
    Defines only the core contracts for session and flash message handling.

  • Framework‑agnostic
    Can be used with any PHP application, regardless of framework or architecture.

  • Storage‑agnostic
    Works with any backend: files, databases, Redis, Swoole\Table, or custom drivers.

  • Runtime‑agnostic
    Compatible with PHP‑FPM, Swoole, RoadRunner, CLI applications, and other runtimes.

  • Predictable behavior
    Clear, minimal interfaces that avoid hidden side effects.

  • Easy integration
    Simple to implement and plug into existing containers, routers, or middleware pipelines.

📦 Installation

Install via Composer:

composer require stougeiro/session-contract

🔧 Implementations

Below is a list of known implementations maintained by the community.

🧠 Why?

This package provides minimal, framework‑agnostic contracts for session and flash message handling in PHP. It exists to give developers full freedom to implement session logic according to the needs of their application — whether using PHP‑FPM, Swoole, RoadRunner, or any other runtime.

By defining only the essential interfaces, this package allows:

  • complete decoupling between application code and session storage
  • custom session lifecycles
  • pluggable backends (files, SQLite, Redis, Swoole\Table, databases, etc.)
  • integration with any container or router
  • predictable flash message behavior
  • clean architecture without framework lock‑in

In short:

  • You choose how sessions work.
  • This package only defines the contract.

🤝 Contributions

Contributions are welcome. Feel free to open issues or submit pull requests.