PhpBridgeSessionStorage
extends NativeSessionStorage
in package
Allows session to be started by PHP and managed by Symfony.
Tags
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
$bags
protected
array<string|int, SessionBagInterface>
$bags
= []
$closed
protected
bool
$closed
= false
$metadataBag
protected
MetadataBag
$metadataBag
$saveHandler
protected
AbstractProxy|SessionHandlerInterface
$saveHandler
$started
protected
bool
$started
= false
$emulateSameSite
private
string|null
$emulateSameSite
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 —clear()
Clear all session data in memory.
public
clear() : mixed
Return values
mixed —getBag()
Gets a SessionBagInterface by name.
public
getBag(string $name) : SessionBagInterface
Parameters
- $name : string
Return values
SessionBagInterface —getId()
Returns the session ID.
public
getId() : string
Return values
string —getMetadataBag()
Gets the MetadataBag.
public
getMetadataBag() : MetadataBag
Return values
MetadataBag —getName()
Returns the session name.
public
getName() : string
Return values
string —getSaveHandler()
Gets the save handler instance.
public
getSaveHandler() : AbstractProxy|SessionHandlerInterface
Return values
AbstractProxy|SessionHandlerInterface —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 —registerBag()
Registers a SessionBagInterface for use.
public
registerBag(SessionBagInterface $bag) : mixed
Parameters
- $bag : SessionBagInterface
Return values
mixed —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 —setMetadataBag()
public
setMetadataBag([MetadataBag|null $metaBag = null ]) : mixed
Parameters
- $metaBag : MetadataBag|null = null
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
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
Return values
mixed —start()
Starts the session.
public
start() : bool
Return values
bool —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