Session
Session
Session controller helper for managing authentication state.
class Session implements \Hazaar\Controller\Interface\Helper , \ArrayAccessImplements: Hazaar\Controller\Interface\Helper, ArrayAccess
This 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 $sessionType: Hazaar\Auth\Adapter
Methods
__construct
Setup the session helper with configuration during the helper import phase.
public __construct(?Adapter $session): voidParameters
| Parameter | Type | Description |
|---|---|---|
$session | Hazaar\Auth\Adapter |
__call
Magic method to handle dynamic method calls on the authentication adapter.
public __call(string $name, array $arguments): mixedReturns: mixed
If 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): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$response | Hazaar\Controller\Response | the response object to commit authentication state to |
offsetExists
public offsetExists(mixed $offset): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$offset | mixed |
offsetGet
public offsetGet(mixed $offset): mixedReturns: mixed
Parameters
| Parameter | Type | Description |
|---|---|---|
$offset | mixed |
offsetSet
public offsetSet(mixed $offset, mixed $value): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$offset | mixed | |
$value | mixed |
offsetUnset
public offsetUnset(mixed $offset): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$offset | mixed |
Generated by Hazaar API Doc Generator on Fri, 04 Sep 2026 23:32:16 +0000