StartSession
in package
Table of Contents
- $manager : SessionManager
- The session manager.
- $sessionHandled : bool
- Indicates if the session was handled for the current request.
- __construct() : void
- Create a new session middleware.
- getSession() : Session
- Get the session implementation from the manager.
- handle() : mixed
- Handle an incoming request.
- terminate() : void
- Perform any final actions for the request lifecycle.
- addCookieToResponse() : void
- Add the session cookie to the application response.
- collectGarbage() : void
- Remove the garbage from the session if necessary.
- configHitsLottery() : bool
- Determine if the configuration odds hit the lottery.
- getCookieExpirationDate() : DateTimeInterface
- Get the cookie lifetime in seconds.
- getSessionLifetimeInSeconds() : int
- Get the session lifetime in seconds.
- sessionConfigured() : bool
- Determine if a session driver has been configured.
- sessionIsPersistent() : bool
- Determine if the configured session driver is persistent.
- startSession() : Session
- Start the session for the given request.
- storeCurrentUrl() : void
- Store the current URL for the request if necessary.
- usingCookieSessions() : bool
- Determine if the session is using cookie sessions.
Properties
$manager
The session manager.
protected
SessionManager
$manager
$sessionHandled
Indicates if the session was handled for the current request.
protected
bool
$sessionHandled
= false
Methods
__construct()
Create a new session middleware.
public
__construct(SessionManager $manager) : void
Parameters
- $manager : SessionManager
Return values
void —getSession()
Get the session implementation from the manager.
public
getSession(Request $request) : Session
Parameters
- $request : Request
Return values
Session —handle()
Handle an incoming request.
public
handle(Request $request, Closure $next) : mixed
Parameters
- $request : Request
- $next : Closure
Return values
mixed —terminate()
Perform any final actions for the request lifecycle.
public
terminate(Request $request, Response $response) : void
Parameters
Return values
void —addCookieToResponse()
Add the session cookie to the application response.
protected
addCookieToResponse(Response $response, Session $session) : void
Parameters
Return values
void —collectGarbage()
Remove the garbage from the session if necessary.
protected
collectGarbage(Session $session) : void
Parameters
- $session : Session
Return values
void —configHitsLottery()
Determine if the configuration odds hit the lottery.
protected
configHitsLottery(array<string|int, mixed> $config) : bool
Parameters
- $config : array<string|int, mixed>
Return values
bool —getCookieExpirationDate()
Get the cookie lifetime in seconds.
protected
getCookieExpirationDate() : DateTimeInterface
Return values
DateTimeInterface —getSessionLifetimeInSeconds()
Get the session lifetime in seconds.
protected
getSessionLifetimeInSeconds() : int
Return values
int —sessionConfigured()
Determine if a session driver has been configured.
protected
sessionConfigured() : bool
Return values
bool —sessionIsPersistent()
Determine if the configured session driver is persistent.
protected
sessionIsPersistent([array<string|int, mixed>|null $config = null ]) : bool
Parameters
- $config : array<string|int, mixed>|null = null
Return values
bool —startSession()
Start the session for the given request.
protected
startSession(Request $request) : Session
Parameters
- $request : Request
Return values
Session —storeCurrentUrl()
Store the current URL for the request if necessary.
protected
storeCurrentUrl(Request $request, Session $session) : void
Parameters
Return values
void —usingCookieSessions()
Determine if the session is using cookie sessions.
protected
usingCookieSessions() : bool