class StartSession

Properties

protected SessionManager $manager

The session manager.

protected bool $sessionHandled

Indicates if the session was handled for the current request.

Methods

void
__construct(SessionManager $manager)

Create a new session middleware.

mixed
handle(Request $request, Closure $next)

Handle an incoming request.

void
terminate(Request $request, Response $response)

Perform any final actions for the request lifecycle.

startSession(Request $request)

Start the session for the given request.

getSession(Request $request)

Get the session implementation from the manager.

void
collectGarbage(Session $session)

Remove the garbage from the session if necessary.

bool
configHitsLottery(array $config)

Determine if the configuration odds hit the lottery.

void
storeCurrentUrl(Request $request, Session $session)

Store the current URL for the request if necessary.

void
addCookieToResponse(Response $response, Session $session)

Add the session cookie to the application response.

int
getSessionLifetimeInSeconds()

Get the session lifetime in seconds.

getCookieExpirationDate()

Get the cookie lifetime in seconds.

bool
sessionConfigured()

Determine if a session driver has been configured.

bool
sessionIsPersistent(array $config = null)

Determine if the configured session driver is persistent.

bool
usingCookieSessions()

Determine if the session is using cookie sessions.

Details

at line 37
void __construct(SessionManager $manager)

Create a new session middleware.

Parameters

SessionManager $manager

Return Value

void

at line 49
mixed handle(Request $request, Closure $next)

Handle an incoming request.

Parameters

Request $request
Closure $next

Return Value

mixed

at line 85
void terminate(Request $request, Response $response)

Perform any final actions for the request lifecycle.

Parameters

Request $request
Response $response

Return Value

void

at line 98
protected Session startSession(Request $request)

Start the session for the given request.

Parameters

Request $request

Return Value

Session

at line 113
Session getSession(Request $request)

Get the session implementation from the manager.

Parameters

Request $request

Return Value

Session

at line 126
protected void collectGarbage(Session $session)

Remove the garbage from the session if necessary.

Parameters

Session $session

Return Value

void

at line 144
protected bool configHitsLottery(array $config)

Determine if the configuration odds hit the lottery.

Parameters

array $config

Return Value

bool

at line 156
protected void storeCurrentUrl(Request $request, Session $session)

Store the current URL for the request if necessary.

Parameters

Request $request
Session $session

Return Value

void

at line 170
protected void addCookieToResponse(Response $response, Session $session)

Add the session cookie to the application response.

Parameters

Response $response
Session $session

Return Value

void

at line 190
protected int getSessionLifetimeInSeconds()

Get the session lifetime in seconds.

Return Value

int

at line 200
protected DateTimeInterface getCookieExpirationDate()

Get the cookie lifetime in seconds.

Return Value

DateTimeInterface

at line 212
protected bool sessionConfigured()

Determine if a session driver has been configured.

Return Value

bool

at line 223
protected bool sessionIsPersistent(array $config = null)

Determine if the configured session driver is persistent.

Parameters

array $config

Return Value

bool

at line 235
protected bool usingCookieSessions()

Determine if the session is using cookie sessions.

Return Value

bool