class StartSession (View source)

Properties

protected SessionManager $manager

The session manager.

protected callable|null $cacheFactoryResolver

The callback that can resolve an instance of the cache factory.

Methods

void
__construct(SessionManager $manager, callable $cacheFactoryResolver = null)

Create a new session middleware.

mixed
handle(Request $request, Closure $next)

Handle an incoming request.

mixed
handleRequestWhileBlocking(Request $request, Session $session, Closure $next)

Handle the given request within session state.

mixed
handleStatefulRequest(Request $request, Session $session, Closure $next)

Handle the given request within session state.

startSession(Request $request, Session $session)

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.

void
saveSession(Request $request)

Save the session data to storage.

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.

Store
cache(string $driver)

Resolve the given cache driver.

Details

void __construct(SessionManager $manager, callable $cacheFactoryResolver = null)

Create a new session middleware.

Parameters

SessionManager $manager
callable $cacheFactoryResolver

Return Value

void

mixed handle(Request $request, Closure $next)

Handle an incoming request.

Parameters

Request $request
Closure $next

Return Value

mixed

protected mixed handleRequestWhileBlocking(Request $request, Session $session, Closure $next)

Handle the given request within session state.

Parameters

Request $request
Session $session
Closure $next

Return Value

mixed

protected mixed handleStatefulRequest(Request $request, Session $session, Closure $next)

Handle the given request within session state.

Parameters

Request $request
Session $session
Closure $next

Return Value

mixed

protected Session startSession(Request $request, Session $session)

Start the session for the given request.

Parameters

Request $request
Session $session

Return Value

Session

Session getSession(Request $request)

Get the session implementation from the manager.

Parameters

Request $request

Return Value

Session

protected void collectGarbage(Session $session)

Remove the garbage from the session if necessary.

Parameters

Session $session

Return Value

void

protected bool configHitsLottery(array $config)

Determine if the configuration odds hit the lottery.

Parameters

array $config

Return Value

bool

protected void storeCurrentUrl(Request $request, Session $session)

Store the current URL for the request if necessary.

Parameters

Request $request
Session $session

Return Value

void

protected void addCookieToResponse(Response $response, Session $session)

Add the session cookie to the application response.

Parameters

Response $response
Session $session

Return Value

void

protected void saveSession(Request $request)

Save the session data to storage.

Parameters

Request $request

Return Value

void

protected int getSessionLifetimeInSeconds()

Get the session lifetime in seconds.

Return Value

int

protected DateTimeInterface|int getCookieExpirationDate()

Get the cookie lifetime in seconds.

Return Value

DateTimeInterface|int

protected bool sessionConfigured()

Determine if a session driver has been configured.

Return Value

bool

protected bool sessionIsPersistent(array $config = null)

Determine if the configured session driver is persistent.

Parameters

array $config

Return Value

bool

protected Store cache(string $driver)

Resolve the given cache driver.

Parameters

string $driver

Return Value

Store