PHPackages                             ellipse/session-start - 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. ellipse/session-start

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

ellipse/session-start
=====================

Psr-15 middleware allowing to use session with Psr-7 request and response

1.0.3(8y ago)130611MITPHPPHP &gt;=7.0

Since Nov 18Pushed 8y ago1 watchersCompare

[ Source](https://github.com/ellipsephp/session-start)[ Packagist](https://packagist.org/packages/ellipse/session-start)[ Docs](https://github.com/ellipsephp/session-start)[ RSS](/packages/ellipse-session-start/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (7)Versions (5)Used By (1)

Session start
=============

[](#session-start)

This package provides a [Psr-15 middleware](https://www.php-fig.org/psr/psr-15/) allowing to use session with Psr-7 request and response.

**Require** php &gt;= 7.0

**Installation** `composer require ellipse/session-start`

**Run tests** `./vendor/bin/kahlan`

- [Using the start session middleware](#using-the-start-session-middleware)

Using the start session middleware
==================================

[](#using-the-start-session-middleware)

This middleware use the default php session mechanism adapted to Psr-7 request and response flow. The default php session cookie is disabled and the session id is manually stored in a cookie readed from the Psr-7 request and attached to the Psr-7 response.

By default values returned by `session_name()` and `session_get_cookie_params` are used to build the session cookie. An optional array of options can be given to the middleware in order to overwrite those default values:

- (string) **name**: the session cookie name
- (string) **path**: the session cookie path
- (string) **domain**: the session cookie domain
- (int) **lifetime**: the session cookie lifetime in second
- (bool) **secure**: whether the session cookie should only be sent over secure connections
- (bool) **httponly**: whether the session cookie can only be accessed through the HTTP protocol

The middleware can of course be used after the `SessionHandlerMiddleware` from [ellipse/session-handler](https://github.com/ellipsephp/session-handler) in order to use a custom session handler.

```
