SessionManager implements SessionManagerInterface
Default implementation of SessionManagerInterface.
Tags
Table of Contents
Interfaces
- SessionManagerInterface
- Factory interface for creating session instances.
Properties
- $logger : LoggerInterface
- $store : SessionStoreInterface
Methods
- __construct() : mixed
- create() : SessionInterface
- Creates a new session with an auto-generated UUID.
- createWithId() : SessionInterface
- Creates a session with a specific UUID.
- destroy() : bool
- Destroys the session with the given UUID.
- exists() : bool
- Checks if a session with the given UUID exists.
- gc() : void
- Run garbage collection on expired sessions.
Properties
$logger read-only
private
LoggerInterface
$logger
= new NullLogger()
$store read-only
private
SessionStoreInterface
$store
Methods
__construct()
public
__construct(SessionStoreInterface $store[, LoggerInterface $logger = new NullLogger() ]) : mixed
Parameters
- $store : SessionStoreInterface
- $logger : LoggerInterface = new NullLogger()
create()
Creates a new session with an auto-generated UUID.
public
create() : SessionInterface
This is the standard factory method for creating sessions.
Return values
SessionInterfacecreateWithId()
Creates a session with a specific UUID.
public
createWithId(Uuid $id) : SessionInterface
Use this when you need to reconstruct a session with a known ID.
Parameters
- $id : Uuid
Return values
SessionInterfacedestroy()
Destroys the session with the given UUID.
public
destroy(Uuid $id) : bool
Parameters
- $id : Uuid
Return values
boolexists()
Checks if a session with the given UUID exists.
public
exists(Uuid $id) : bool
Parameters
- $id : Uuid
Return values
boolgc()
Run garbage collection on expired sessions.
public
gc() : void
Uses the session store's internal TTL configuration.