1. Go to this page and download the library: Download jasny/session-middleware library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jasny / session-middleware example snippets
use Jasny\Session\SessionMiddleware;
$router->add(new SessionMiddleware());
$response = $router->handle($request);
$session->flash('success', 'The information has been saved');
$session->flashes()
->reissue()
->add('warning', "Could not display the page");
header('Location: /other-page');
exit();
use Jasny\Session\MockSession;
$session = new MockSession([
'foo.user' => '[email protected]'
]);
$requestWithSession = $request->withAttribute('session', $session);
$response = $router->handle($requestWithSession);
use Jasny\Session\SessionMiddleware;
use Jasny\Session\MockSession;
$mockSession = new MockSession();
$router->add(new SessionMiddleware($mockSession));
$response = $router->handle($request);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.