objects

Session

Session values and flash messages under one name, so views and addons can't overwrite each other's keys.

Login and throttling are on SessionRoot, outside every scope.

$session Phlat\Session 6 methods
Show
  • delete Removes the value under $key.
  • flash Stores $value for the next request only; read it with pop().
  • get The value stored under $key, or null.
  • has Whether a value is stored under $key.
  • pop Reads and removes a flashed value.
  • set Stores $value under $key and returns it.

Methods

$session->delete(string $key): void

Removes the value under $key.

Parameters (1)
$key string
phlat/src/Session.php:48
$session->flash(string $key, mixed $value): void

Stores $value for the next request only; read it with pop().

Parameters (2)
$key string
$value mixed
phlat/src/Session.php:55

get

$session->get(string $key): mixed

The value stored under $key, or null.

Parameters (1)
$key string

Returns mixed

phlat/src/Session.php:26

has

$session->has(string $key): bool

Whether a value is stored under $key.

Parameters (1)
$key string

Returns bool

phlat/src/Session.php:41

pop

$session->pop(string $key, mixed $default = null): mixed

Reads and removes a flashed value.

Parameters (2)
$key string
$default mixed = null

Returns mixed

phlat/src/Session.php:62

set

$session->set(string $key, mixed $value): mixed

Stores $value under $key and returns it.

Parameters (2)
$key string
$value mixed

Returns mixed

phlat/src/Session.php:33