SessionNamespace
final class SessionNamespace (View source)
Isolates a logical key space inside one parent session without owning its lifecycle.
Constants
| private SESSION_KEY_PREFIX |
|
Methods
Connects a validated logical namespace to the parent session's shared lifecycle.
Checks whether this namespace contains a value for the key.
Returns a namespaced value or the caller-provided fallback.
Stores or replaces one value without changing other namespaces.
Removes one value while preserving the rest of this namespace.
Returns all normalized values without mutating this namespace.
Removes this complete namespace without affecting other parent session data.
Details
__construct
__construct(SessionInterface $session, string $name)
Connects a validated logical namespace to the parent session's shared lifecycle.
has
bool
has(string $key)
Checks whether this namespace contains a value for the key.
get
mixed
get(string $key, mixed $default = null)
Returns a namespaced value or the caller-provided fallback.
set
void
set(string $key, mixed $value)
Stores or replaces one value without changing other namespaces.
remove
void
remove(string $key)
Removes one value while preserving the rest of this namespace.
all
array
all()
Returns all normalized values without mutating this namespace.
clear
void
clear()
Removes this complete namespace without affecting other parent session data.