Header
Header
Header-based session token transport.
Handles extracting and persisting tokens via HTTP Authorization headers.
Properties
options
Options for configuring the header transport.
private array $optionsMethods
__construct
Constructor for HeaderTransport.
public __construct(array $config): voidInitializes the transport with the specified HTTP header name and prefix to be used for session authorization. By default, it uses the 'Authorization' header with the 'Bearer' prefix.
Parameters
| Parameter | Type | Description |
|---|---|---|
$config | array |
extractToken
Extracts the bearer token from the specified HTTP header.
public extractToken(): ?stringThis method checks the server's $_SERVER superglobal for the presence of the configured header (converted to uppercase and underscores as per PHP's convention). If the header exists and its value starts with 'Bearer ', the method returns the token part (the string after 'Bearer '). If the header is not present or does not contain a bearer token, it returns null.
persistToken
Persists the authentication token by setting it in the response header.
public persistToken(Response $response, string $token, array $options): voidParameters
| Parameter | Type | Description |
|---|---|---|
$response | Response | the response object where the header will be set |
$token | string | the authentication token to be persisted |
$options | array | optional settings for token persistence (currently unused) |
clearToken
Clears the authentication token by resetting the Authorization header.
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