PHPackages                             innmind/http-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. [HTTP &amp; Networking](/categories/http)
4. /
5. innmind/http-session

ActiveLibrary[HTTP &amp; Networking](/categories/http)

innmind/http-session
====================

HTTP session

5.0.0(2mo ago)013[2 issues](https://github.com/Innmind/HttpSession/issues)MITPHPPHP ~8.4CI passing

Since Aug 12Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/Innmind/HttpSession)[ Packagist](https://packagist.org/packages/innmind/http-session)[ Docs](http://github.com/Innmind/HttpSession)[ RSS](/packages/innmind-http-session/feed)WikiDiscussions develop Synced 3d ago

READMEChangelog (5)Dependencies (4)Versions (16)Used By (0)

Http session
============

[](#http-session)

[![CI](https://github.com/Innmind/HttpSession/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/Innmind/HttpSession/actions/workflows/ci.yml)[![codecov](https://camo.githubusercontent.com/c6f733582910934cd067726f2263d61d7059776fe21858c87e863fe0d9650db2/68747470733a2f2f636f6465636f762e696f2f67682f496e6e6d696e642f4874747053657373696f6e2f6272616e63682f646576656c6f702f67726170682f62616467652e737667)](https://codecov.io/gh/Innmind/HttpSession)[![Type Coverage](https://camo.githubusercontent.com/613b850fe4bb166dc94367dc24ec709b9bf0b4c5b70560c0c420d202c7ac9023/68747470733a2f2f73686570686572642e6465762f6769746875622f496e6e6d696e642f4874747053657373696f6e2f636f7665726167652e737667)](https://shepherd.dev/github/Innmind/HttpSession)

Library to manage session for http requests.

The goal is to break the paradigm of considering the request and response as a global environment. Request and response should be delt as transiting data. The session for a request should obey this principle as well, thus the signature `Manager::start(ServerRequest): Maybe`.

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

[](#installation)

```
composer require innmind/http-session
```

Usage
-----

[](#usage)

```
use Innmind\HttpSession\Manager\Native;
use Innmind\Http\{
    Response,
    Response\StatusCode,
    ServerRequest,
    Headers,
    Header\SetCookie,
    Header\SetCookie\Directive,
    Header\SetCookie\Domain,
};

$manager = Native::of();
$request = /* an instance of ServerRequest */

$session = $manager->start($request)->match(
    static fn($session) => $session,
    static fn() => throw new \RuntimeException('Unable to start the exception'),
);
// inject some data in the session
$manager->save($session);

$response = Response::of(
    StatusCode::ok,
    $request->protocolVersion(),
    Headers::of(
        SetCookie::of(
            $session->name()->toString(),
            $session->id()->toString(),
            Directive::httpOnly,
            Domain::of($request->url()->authority()->host()),
        ),
    ),
);
// send the response
```

Note

You should take a look at [`innmind/http-server`](https://github.com/Innmind/HttpServer) in order to know how to have access to an instance of `ServerRequest` and send the `Response`.

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance89

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity87

Battle-tested with a long release history

 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 ~305 days

Recently: every ~278 days

Total

10

Last Release

88d ago

Major Versions

1.0.1 → 2.0.02020-03-01

2.1.0 → 3.0.02023-01-14

3.2.0 → 4.0.02023-10-22

4.1.0 → 5.0.02026-02-15

PHP version history (6 changes)1.0.0PHP ~7.2

2.0.0PHP ~7.4

2.1.0PHP ~7.4|~8.0

3.0.0PHP ~8.1

4.0.0PHP ~8.2

5.0.0PHP ~8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/851425?v=4)[Baptiste Langlade](/maintainers/Baptouuuu)[@Baptouuuu](https://github.com/Baptouuuu)

---

Top Contributors

[![Baptouuuu](https://avatars.githubusercontent.com/u/851425?v=4)](https://github.com/Baptouuuu "Baptouuuu (87 commits)")

---

Tags

httpsession

### Embed Badge

![Health badge](/badges/innmind-http-session/health.svg)

```
[![Health](https://phpackages.com/badges/innmind-http-session/health.svg)](https://phpackages.com/packages/innmind-http-session)
```

###  Alternatives

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

8.0k1.0B3.2k](/packages/guzzlehttp-psr7)[psr/http-message

Common interface for HTTP messages

7.1k1.0B5.5k](/packages/psr-http-message)[nette/http

🌐 Nette Http: abstraction for HTTP request, response and session. Provides careful data sanitization and utility for URL and cookies manipulation.

48619.2M541](/packages/nette-http)[aplus/app

Aplus Framework App Project

5951.6M1](/packages/aplus-app)[kdyby/fake-session

FakeSession class for Nette Framework

11354.8k7](/packages/kdyby-fake-session)[mrclay/shibalike

Provides a PHP library for emulating a Shibboleth environment.

2060.5k7](/packages/mrclay-shibalike)

PHPackages © 2026

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