Cookie
Less than 1 minute
Cookie
Cookie-based session token transport.
Handles extracting and persisting tokens via HTTP cookies.
Properties
cookieName
The name of the cookie used for session transport.
private string $cookieNameoptions
private array $optionsMethods
__construct
CookieTransport constructor.
public __construct(array $cookieOptions): voidParameters
| Parameter | Type | Description |
|---|---|---|
$cookieOptions | array |
extractToken
Extracts the authentication token from the cookie.
public extractToken(): ?stringRetrieves the value of the cookie specified by $this->cookieName from the $_COOKIE superglobal. Returns the token as a string if the cookie exists, or null if it does not.
persistToken
Persists the authentication token in a cookie with the specified options.
public persistToken(Response $response, string $token, array $options): voidParameters
| Parameter | Type | Description |
|---|---|---|
$response | Response | |
$token | string | the authentication token to be stored in the cookie |
$options | array |
clearToken
Clears the authentication token by removing the corresponding cookie.
public clearToken(Response $response, array $options): voidParameters
| Parameter | Type | Description |
|---|---|---|
$response | Response | |
$options | array |
Generated by Hazaar API Doc Generator on Sun, 01 Mar 2026 09:22:26 +0000