src/Viserio/Component/Session/Middleware/StartSessionMiddleware.php
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        // We need to start the session so that the data is ready.
        // Note that the Narrowspark sessions do not make use of PHP
        // "native" sessions in any way since they are crappy.
        $session = $this->startSession($request);

        $request = $request->withAttribute('session', $session);

        $this->collectGarbage($session);

        $response = $handler->handle($request);

        // Again, if the session has been configured we will need to close out the session
        // so that the attributes may be persisted to some storage medium. We will also
        // add the session identifier cookie to the application response headers now.
        $session = $this->storeCurrentUrl($request, $session);

        return $this->addCookieToResponse($request, $response, $session);
    }
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        // We need to start the session so that the data is ready.
        // Note that the Narrowspark sessions do not make use of PHP
        // "native" sessions in any way since they are crappy.
        $session = $this->startSession($request);

        $request = $request->withAttribute('session', $session);

        $this->collectGarbage($session);

        $response = $handler->handle($request);

        // Again, if the session has been configured we will need to close out the session
        // so that the attributes may be persisted to some storage medium. We will also
        // add the session identifier cookie to the application response headers now.
        $session = $this->storeCurrentUrl($request, $session);

        return $this->addCookieToResponse($request, $response, $session);
    }
{@inheritdoc}