Properties

$storage

$storage

$flashName

$flashName

$attributeName

$attributeName

$data

$data

$usageIndex

$usageIndex

$usageReporter

$usageReporter

Methods

__construct()

__construct(\Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface  $storage = null, \Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface  $attributes = null, \Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface  $flashes = null, callable  $usageReporter = null) : mixed

Parameters

\Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface $storage
\Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface $attributes
\Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface $flashes
callable $usageReporter

Returns

mixed —

start()

start() : bool

Starts the session storage.

Returns

bool —

has()

has(string  $name) : bool

Checks if an attribute is defined.

Parameters

string $name

Returns

bool —

get()

get(string  $name, mixed  $default = null) : mixed

Returns an attribute.

Parameters

string $name
mixed $default

The default value if not found

Returns

mixed —

set()

set(string  $name, mixed  $value) : mixed

Sets an attribute.

Parameters

string $name
mixed $value

Returns

mixed —

all()

all() : array

Returns attributes.

Returns

array —

replace()

replace(array  $attributes) : mixed

Sets attributes.

Parameters

array $attributes

Returns

mixed —

remove()

remove(string  $name) : mixed

Removes an attribute.

Parameters

string $name

Returns

mixed —

The removed value or null when it does not exist

clear()

clear() : mixed

Clears all attributes.

Returns

mixed —

isStarted()

isStarted() : bool

Checks if the session was started.

Returns

bool —

getIterator()

getIterator() : \ArrayIterator<string,mixed>

Returns an iterator for attributes.

Returns

\ArrayIterator

count()

count() : int

Returns the number of attributes.

Returns

int —

getUsageIndex()

& getUsageIndex() : int

Returns

int —

invalidate()

invalidate(int  $lifetime = null) : bool

Invalidates the current session.

Parameters

int $lifetime

Sets the cookie lifetime for the session cookie. A null value will leave the system settings unchanged, 0 sets the cookie to expire with browser session. Time is in seconds, and is not a Unix timestamp.

Returns

bool —

migrate()

migrate(bool  $destroy = false, int  $lifetime = null) : bool

Migrates the current session to a new session id while maintaining all session attributes.

Parameters

bool $destroy

Whether to delete the old session or leave it to garbage collection

int $lifetime

Sets the cookie lifetime for the session cookie. A null value will leave the system settings unchanged, 0 sets the cookie to expire with browser session. Time is in seconds, and is not a Unix timestamp.

Returns

bool —

save()

save() : mixed

Force the session to be saved and closed.

Returns

mixed —

getId()

getId() : string

Returns the session ID.

Returns

string —

setId()

setId(string  $id) : mixed

Sets the session ID.

Parameters

string $id

Returns

mixed —

getName()

getName() : string

Returns the session name.

Returns

string —

setName()

setName(string  $name) : mixed

Sets the session name.

Parameters

string $name

Returns

mixed —

getMetadataBag()

getMetadataBag() : \Symfony\Component\HttpFoundation\Session\Storage\MetadataBag

Gets session meta.

Returns

\Symfony\Component\HttpFoundation\Session\Storage\MetadataBag —

registerBag()

registerBag(\Symfony\Component\HttpFoundation\Session\SessionBagInterface  $bag) : mixed

Registers a SessionBagInterface with the session.

Parameters

\Symfony\Component\HttpFoundation\Session\SessionBagInterface $bag

Returns

mixed —

getBag()

getBag(string  $name) : \Symfony\Component\HttpFoundation\Session\SessionBagInterface

Gets a bag instance by name.

Parameters

string $name

Returns

\Symfony\Component\HttpFoundation\Session\SessionBagInterface —

getFlashBag()

getFlashBag() : \Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface

Gets the flashbag interface.

Returns

\Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface —

getAttributeBag()

getAttributeBag() : \Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface

Gets the attributebag interface.

Note that this method was added to help with IDE autocompletion.

Returns

\Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface —