interface FlashBagAwareSessionInterface implementsSessionInterface

Interface for session with a flashbag.

Methods

bool
start()

Starts the session storage.

string
getId()

Returns the session ID.

void
setId(string$id)

Sets the session ID.

string
getName()

Returns the session name.

void
setName(string$name)

Sets the session name.

bool
invalidate(int|null$lifetime =null)

Invalidates the current session.

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

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

void
save()

Force the session to be saved and closed.

bool
has(string$name)

Checks if an attribute is defined.

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

Returns an attribute.

void
set(string$name,mixed$value)

Sets an attribute.

array
all()

Returns attributes.

void
replace(array$attributes)

Sets attributes.

mixed
remove(string$name)

Removes an attribute.

void
clear()

Clears all attributes.

bool
isStarted()

Checks if the session was started.

void
registerBag(SessionBagInterface$bag)

Registers a SessionBagInterface with the session.

getBag(string$name)

Gets a bag instance by name.

MetadataBag
getMetadataBag()

Gets session meta.

FlashBagInterface
getFlashBag()

No description

Details

bool start()

Starts the session storage.

Return Value

bool

Exceptions

RuntimeException if session fails to start

string getId()

Returns the session ID.

Return Value

string

void setId(string$id)

Sets the session ID.

Parameters

string $id

Return Value

void

string getName()

Returns the session name.

Return Value

string

void setName(string$name)

Sets the session name.

Parameters

string $name

Return Value

void

bool invalidate(int|null$lifetime =null)

Invalidates the current session.

Clears all session attributes and flashes and regenerates the session and deletes the old session from persistence.

Parameters

int|null $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.

Return Value

bool

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

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|null $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.

Return Value

bool

void save()

Force the session to be saved and closed.

This method is generally not required for real sessions as the session will be automatically saved at the end of code execution.

Return Value

void

bool has(string$name)

Checks if an attribute is defined.

Parameters

string $name

Return Value

bool

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

Returns an attribute.

Parameters

string $name
mixed $default

Return Value

mixed

void set(string$name,mixed$value)

Sets an attribute.

Parameters

string $name
mixed $value

Return Value

void

array all()

Returns attributes.

Return Value

array

void replace(array$attributes)

Sets attributes.

Parameters

array $attributes

Return Value

void

mixed remove(string$name)

Removes an attribute.

Parameters

string $name

Return Value

mixed The removed value or null when it does not exist

void clear()

Clears all attributes.

Return Value

void

bool isStarted()

Checks if the session was started.

Return Value

bool

void registerBag(SessionBagInterface$bag)

Registers a SessionBagInterface with the session.

Parameters

SessionBagInterface $bag

Return Value

void

SessionBagInterface getBag(string$name)

Gets a bag instance by name.

Parameters

string $name

Return Value

SessionBagInterface

MetadataBag getMetadataBag()

Gets session meta.

Return Value

MetadataBag

FlashBagInterface getFlashBag()

Return Value

FlashBagInterface