On this page

Introduction

This component provides a PSR-6 session persistence adapter for use with mezzio-session.

PSR-6 defines cache items and cache item pools. This package uses a cache item pool in which to store and retrieve sessions. PSR-6 was chosen over the simpler PSR-16 as it specifically provides functionality around expiry, which allows us to expire sessions.

Installation

Install mezzio-session-cache via Composer:

$ composer require mezzio/mezzio-session-cache

You will also need to install a package that provides a PSR-6 CacheItemPoolInterface implementation. You can search for PSR-6 providers on Packagist. We have had excellent luck with the various implementations provided by the PHP-Cache project.

Usage

Generally, you will only provide configuration for this service, including configuring a PSR-6 CacheItemPoolInterface service; mezzio-session will then consume it via its SessionMiddleware.

Found a mistake or want to contribute to the documentation? Edit this page on GitHub!