Middleware

class Middleware implements HttpKernelInterface (View source)

Properties

protected HttpKernelInterface $app The wrapped kernel implementation.
protected SessionManager $manager The session manager.
protected Closure|null $reject The callback to determine to use session arrays.

Methods

void __construct(HttpKernelInterface $app, SessionManager $manager, Closure $reject = null)

Create a new session middleware.

Response handle(Request $request, int $type = HttpKernelInterface::MASTER_REQUEST, bool $catch = true)

Handle the given request and get the response.

void checkRequestForArraySessions(Request $request)

Check the request and reject callback for array sessions.

SessionInterface startSession(Request $request)

Start the session for the given request.

void closeSession(SessionInterface $session)

Close the session handling for the request.

string getUrl(Request $request)

Get the full URL for the request.

void collectGarbage(SessionInterface $session)

Remove the garbage from the session if necessary.

bool configHitsLottery(array $config)

Determine if the configuration odds hit the lottery.

void addCookieToResponse(Response $response, SessionInterface $session)

Add the session cookie to the application response.

getLifetimeSeconds()

Get the session lifetime in seconds.

int getCookieLifetime()

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.

SessionInterface getSession(Request $request)

Get the session implementation from the manager.

Details

void __construct(HttpKernelInterface $app, SessionManager $manager, Closure $reject = null)

Create a new session middleware.

Parameters

HttpKernelInterface $app
SessionManager $manager
Closure $reject

Return Value

void

Response handle(Request $request, int $type = HttpKernelInterface::MASTER_REQUEST, bool $catch = true)

Handle the given request and get the response.

Parameters

Request $request
int $type
bool $catch

Return Value

Response

void checkRequestForArraySessions(Request $request)

Check the request and reject callback for array sessions.

Parameters

Request $request

Return Value

void

protected SessionInterface startSession(Request $request)

Start the session for the given request.

Parameters

Request $request

Return Value

SessionInterface

protected void closeSession(SessionInterface $session)

Close the session handling for the request.

Parameters

SessionInterface $session

Return Value

void

protected string getUrl(Request $request)

Get the full URL for the request.

Parameters

Request $request

Return Value

string

protected void collectGarbage(SessionInterface $session)

Remove the garbage from the session if necessary.

Parameters

SessionInterface $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 addCookieToResponse(Response $response, SessionInterface $session)

Add the session cookie to the application response.

Parameters

Response $response
SessionInterface $session

Return Value

void

protected getLifetimeSeconds()

Get the session lifetime in seconds.

protected int getCookieLifetime()

Get the cookie lifetime in seconds.

Return Value

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

SessionInterface getSession(Request $request)

Get the session implementation from the manager.

Parameters

Request $request

Return Value

SessionInterface

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/4.2/Illuminate/Session/Middleware.html