Documentation

PhpBridgeSessionStorage extends NativeSessionStorage
in package

Allows session to be started by PHP and managed by Symfony.

Tags
author

Drak drak@zikula.org

Table of Contents

$bags  : array<string|int, SessionBagInterface>
$closed  : bool
$metadataBag  : MetadataBag
$saveHandler  : AbstractProxy|SessionHandlerInterface
$started  : bool
$emulateSameSite  : string|null
__construct()  : mixed
Depending on how you want the storage driver to behave you probably want to override this constructor entirely.
clear()  : mixed
Clear all session data in memory.
getBag()  : SessionBagInterface
Gets a SessionBagInterface by name.
getId()  : string
Returns the session ID.
getMetadataBag()  : MetadataBag
Gets the MetadataBag.
getName()  : string
Returns the session name.
getSaveHandler()  : AbstractProxy|SessionHandlerInterface
Gets the save handler instance.
isStarted()  : bool
Checks if the session is started.
regenerate()  : bool
Regenerates id that represents this storage.
registerBag()  : mixed
Registers a SessionBagInterface for use.
save()  : mixed
Force the session to be saved and closed.
setId()  : mixed
Sets the session ID.
setMetadataBag()  : mixed
setName()  : mixed
Sets the session name.
setOptions()  : mixed
Sets session.* ini variables.
setSaveHandler()  : mixed
Registers session save handler as a PHP session handler.
start()  : bool
Starts the session.
loadSession()  : mixed
Load the session with attributes.

Properties

Methods

__construct()

Depending on how you want the storage driver to behave you probably want to override this constructor entirely.

public __construct([AbstractProxy|SessionHandlerInterface|null $handler = null ][, MetadataBag|null $metaBag = null ]) : mixed
Parameters
$handler : AbstractProxy|SessionHandlerInterface|null = null
$metaBag : MetadataBag|null = null
Return values
mixed

isStarted()

Checks if the session is started.

public isStarted() : bool
Return values
bool

regenerate()

Regenerates id that represents this storage.

public regenerate([bool $destroy = false ][, int|null $lifetime = null ]) : bool
Parameters
$destroy : bool = false

Destroy session when regenerating?

$lifetime : int|null = null

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 values
bool

save()

Force the session to be saved and closed.

public save() : mixed
Return values
mixed

setId()

Sets the session ID.

public setId(string $id) : mixed
Parameters
$id : string
Return values
mixed

setName()

Sets the session name.

public setName(string $name) : mixed
Parameters
$name : string
Return values
mixed

setOptions()

Sets session.* ini variables.

public setOptions(array<string|int, mixed> $options) : mixed

For convenience we omit 'session.' from the beginning of the keys. Explicitly ignores other ini keys.

Parameters
$options : array<string|int, mixed>

Session ini directives [key => value]

Tags
see
https://php.net/session.configuration
Return values
mixed

setSaveHandler()

Registers session save handler as a PHP session handler.

public setSaveHandler([AbstractProxy|SessionHandlerInterface|null $saveHandler = null ]) : mixed

To use internal PHP session save handlers, override this method using ini_set with session.save_handler and session.save_path e.g.

ini_set('session.save_handler', 'files');
ini_set('session.save_path', '/tmp');

or pass in a \SessionHandler instance which configures session.save_handler in the constructor, for a template see NativeFileSessionHandler.

Parameters
$saveHandler : AbstractProxy|SessionHandlerInterface|null = null
Tags
see
https://php.net/session-set-save-handler
see
https://php.net/sessionhandlerinterface
see
https://php.net/sessionhandler
throws
InvalidArgumentException
Return values
mixed

loadSession()

Load the session with attributes.

protected loadSession([array<string|int, mixed>|null &$session = null ]) : mixed

After starting the session, PHP retrieves the session from whatever handlers are set to (either PHP's internal, or a custom save handler set with session_set_save_handler()). PHP takes the return value from the read() handler, unserializes it and populates $_SESSION with the result automatically.

Parameters
$session : array<string|int, mixed>|null = null
Return values
mixed

Search results