Installation

Standard Installation

To install the library use Composer:

$ composer require mezzio/mezzio-session-cache

Installation for a Mezzio Application

Installation and Automated Configuration

The laminas-component-installer is the recommended installation method when using in a Mezzio-based application. It will automatically inject the config-provider in the configuration during the installation process.

Installation Requirements

The following descriptions depends on the laminas-component-installer component, so be sure to have it installed before getting started.

Global Installation

With a global installation of laminas-component-installer it can be used for all projects without a reinstallation.

$ composer global require laminas/laminas-component-installer

As Development Dependency

$ composer require --dev laminas/laminas-component-installer

Install mezzio-session-cache and Inject Configuration

To install the library use Composer:

$ composer require mezzio/mezzio-session-cache

This will install an initial set of dependencies and it will also prompt to inject the component configuration.

  • For a Mezzio application, choose config/config.php.

If additional dependencies are to be installed, the option for other packages can be remembered.

Installation and Manual Configuration

If the installer is not used, the manual configuration is needed to add the component to the application.

Install mezzio-session-cache

To install the library use Composer:

$ composer require mezzio/mezzio-session-cache

Manual Configuration for a Mezzio-based Application

Add the configuration provider of mezzio-session-cache to the configuration file, e.g. config/config.php:


$aggregator = new Laminas\ConfigAggregator\ConfigAggregator([
    // …
    Mezzio\ConfigProvider::class,
    Mezzio\Router\ConfigProvider::class,
    Mezzio\Session\Cache\ConfigProvider, // Add this line
    // …
]);

Cache Implementation Required

To use this component, a PSR-6 CacheItemPoolInterface implementation is required. laminas-cache provides the PSR-6 implementations, install it and choose one of the cache adapters.

Install laminas-cache and a Cache Adapter

Install laminas-cache via Composer:

$ composer require laminas/laminas-cache

laminas-cache is shipped without a specific cache adapter to allow free choice of storage backends and their dependencies. For example, install the laminas-cache Filesystem adapter:

$ composer require laminas/laminas-cache-storage-adapter-filesystem

Read More in the laminas-cache Documentation