Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

psr7-sessions/storageless-mezzio-integration

Repository files navigation

PSR-7 Storage-less HTTP Sessions - Mezzio Session Integration

Infection MSI Packagist Packagist

This integration allows you to use storageless as an implementation for mezzio-session

Installation

composer require lcobucci/clock \
                 psr7-sessions/storageless \
                 psr7-sessions/storageless-mezzio-integration

Symmetric key

use Lcobucci\Clock\SystemClock;
use Lcobucci\JWT\Signer\Key\InMemory;
use Mezzio\Session\SessionMiddleware;
use PSR7Sessions\Mezzio\Storageless\SessionPersistence;
use PSR7Sessions\Storageless\Http\SessionMiddleware as PSR7SessionMiddleware;

$app = \Mezzio\AppFactory::create();
$app->pipe(PSR7SessionMiddleware::fromSymmetricKeyDefaults(
    InMemory::plainText('OpcMuKmoxkhzW0Y1iESpjWwL/D3UBdDauJOe742BJ5Q='),
    1200
));
$app->pipe(new SessionMiddleware(new SessionPersistence(new SystemClock())));

Asymmetric key

use Lcobucci\Clock\SystemClock;
use Lcobucci\JWT\Signer\Key\InMemory;
use Mezzio\Session\SessionMiddleware;
use PSR7Sessions\Mezzio\Storageless\SessionPersistence;
use PSR7Sessions\Storageless\Http\SessionMiddleware as PSR7SessionMiddleware;

$app = \Mezzio\AppFactory::create();
$app->pipe(PSR7SessionMiddleware::fromSymmetricKeyDefaults(
    InMemory::file('/path/to/private_key.pem'),
    InMemory::file('/path/to/public_key.pem'),
    1200
));
$app->pipe(new SessionMiddleware(new SessionPersistence(new SystemClock())));

Contributing

Please refer to the contributing notes.

License

This project is made public under the MIT LICENSE.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages