Session
Session
Session controller helper for managing authentication state.
class Session implements \Hazaar\Controller\Helper\Helper , \ArrayAccessThis helper provides methods for authenticating users, logging out, and committing authentication state to the response during the controller shutdown phase. It utilizes an authentication adapter, which can be configured via application configuration, to perform authentication operations.
Usage: $this->session->authenticate($identity, $password); $this->session->logout(); // Authentication state is automatically committed on shutdown.
Properties
session
private Adapter $sessionMethods
__construct
Setup the session helper with configuration during the helper import phase.
public __construct(?Adapter $session): voidParameters
| Parameter | Type | Description |
|---|---|---|
$session | Adapter |
__call
Magic method to handle dynamic method calls on the authentication adapter.
public __call(string $name, array $arguments): mixedIf the authentication adapter is not initialized, it will be created using the configuration provided. Delegates the method call to the authentication adapter if the method exists.
Parameters
| Parameter | Type | Description |
|---|---|---|
$name | string | the name of the method being called |
$arguments | array | the arguments passed to the method |
shutdown
Shutdown No-op method for the session helper. Authentication state is committed via the adapter's commit method,.
public shutdown(Response $response): voidParameters
| Parameter | Type | Description |
|---|---|---|
$response | Response | the response object to commit authentication state to |
offsetExists
public offsetExists(mixed $offset): boolParameters
| Parameter | Type | Description |
|---|---|---|
$offset | mixed |
offsetGet
public offsetGet(mixed $offset): mixedParameters
| Parameter | Type | Description |
|---|---|---|
$offset | mixed |
offsetSet
public offsetSet(mixed $offset, mixed $value): voidParameters
| Parameter | Type | Description |
|---|---|---|
$offset | mixed | |
$value | mixed |
offsetUnset
public offsetUnset(mixed $offset): voidParameters
| Parameter | Type | Description |
|---|---|---|
$offset | mixed |
Generated by Hazaar API Doc Generator on Tue, 21 Apr 2026 04:00:24 +0000