Session
Sessions allow you to persist data across multiple requests for individual users. Common use cases include storing login status, user preferences, and temporary data.
Centum provides session classes that abstract session management, making it easy to interact with session data.
All session classes implement Centum\Interfaces\Http\SessionInterface.
SessionInterface defines the following public methods:
start(): boolisActive(): boolhas(string $name): boolget(string $name, mixed $defaultValue = null): mixedset(string $name, mixed $value): voidremove(string $name): voidclear(): voidall(): array
Available Implementations
Centum provides different session implementations to suit various needs:
Centum\Http\Session\ArraySession— Stores session data in memory (useful for testing).Centum\Http\Session\GlobalSession— Uses PHP’s global$_SESSIONarray.