final class SessionCookie (View source)

internal  
 

Sends and expires the browser cookie that carries one session identifier.

Methods

__construct(string $name, int $lifetimeSeconds, SessionCookieSameSite $sameSite = SessionCookieSameSite::Lax, Closure|null $emitter = null, SessionCookieSecure $secure = SessionCookieSecure::Auto, ResolvedRequestContext|null $requestContext = null)

Defines the host-only cookie identity and its sliding lifetime.

void
send(string $sessionId)

Sends the active identifier with a fresh persistent expiry.

void
void
expire()

Expires the transport cookie so the browser no longer presents the destroyed identity.

void
array

Returns the equivalent parameters required by PHP's native session runtime.

array
void

Fails before an identity-changing operation can diverge from browser state.

void

Details

__construct

__construct(string $name, int $lifetimeSeconds, SessionCookieSameSite $sameSite = SessionCookieSameSite::Lax, Closure|null $emitter = null, SessionCookieSecure $secure = SessionCookieSecure::Auto, ResolvedRequestContext|null $requestContext = null)

Defines the host-only cookie identity and its sliding lifetime.

Parameters

string $name
int $lifetimeSeconds
SessionCookieSameSite $sameSite
Closure|null $emitter
SessionCookieSecure $secure
ResolvedRequestContext|null $requestContext

send

void send(string $sessionId)

Sends the active identifier with a fresh persistent expiry.

Parameters

string $sessionId

Return Value

void

expire

void expire()

Expires the transport cookie so the browser no longer presents the destroyed identity.

Return Value

void

nativeParameters

array nativeParameters()

Returns the equivalent parameters required by PHP's native session runtime.

Return Value

array

assertCanChange

void assertCanChange()

Fails before an identity-changing operation can diverge from browser state.

Return Value

void