SessionManager
class SessionManager extends Manager mixin Store
Traits
Properties
| protected Repository | $config | The configuration repository instance. |
from Manager |
| protected Closure> | $customCreators | The registered custom driver creators. |
from Manager |
| protected array<array-key, mixed> | $drivers | The array of created "drivers". |
from Manager |
Methods
Get the default session driver name.
Call a custom driver creator.
Dynamically call the default driver instance.
Create an instance of the "null" session driver.
Create an instance of the "array" session driver.
Create an instance of the "cookie" session driver.
Create an instance of the file session driver.
Create an instance of the file session driver.
Create an instance of the database session driver.
Create an instance of the Redis session driver.
Determine if the configured driver supports user session management.
Get a user-scoped session repository.
Determine if requests for the same session should wait for each to finish before executing.
Get the name of the cache store / driver that should be used to acquire session locks.
Get the maximum number of seconds the session lock should be held for.
Get the maximum number of seconds to wait while attempting to acquire a route block session lock.
Get the session configuration.
Set the default session driver name.
Details
in
RebindsCallbacksToSelf at line 18
protected Closure|null
bindCallbackToSelf(Closure $callback)
Bind the provided callback to the class instance.
at line 283
string|null
getDefaultDriver()
Get the default session driver name.
in
Manager at line 57
mixed
driver(UnitEnum|string|null $driver = null)
Get a driver instance.
in
Manager at line 89
protected mixed
createDriver(string $driver)
Create a new driver instance.
at line 28
protected mixed
callCustomCreator(string $driver)
Call a custom driver creator.
in
Manager at line 126
Manager
extend(string $driver, Closure $callback)
Register a custom driver creator Closure.
Anonymous closures run in this manager's class scope; non-static closures also receive the manager as $this.
Boot-only. The callback persists in the singleton's customCreators array for the worker lifetime and applies to every subsequent driver resolution.
in
Manager at line 145
array
getDrivers()
Get all of the created "drivers".
in
Manager at line 167
Manager
setContainer(Container $container)
Set the container instance used by the manager.
Tests only. Swaps the singleton's container and configuration references; per-request use races across coroutines and breaks every concurrent driver resolution through this manager.
in
Manager at line 184
Manager
forgetDrivers()
Forget all of the resolved driver instances.
Boot or tests only. Clears the singleton's driver cache; concurrent coroutines may already hold references that next resolution will not share.
in
Manager at line 194
mixed
__call(string $method, array $parameters)
Dynamically call the default driver instance.
at line 36
protected Store
createNullDriver()
Create an instance of the "null" session driver.
at line 44
protected Store
createArrayDriver()
Create an instance of the "array" session driver.
at line 54
protected Store
createCookieDriver()
Create an instance of the "cookie" session driver.
at line 66
protected Store
createFileDriver()
Create an instance of the file session driver.
at line 74
protected Store
createNativeDriver()
Create an instance of the file session driver.
at line 88
protected Store
createDatabaseDriver()
Create an instance of the database session driver.
at line 110
protected Store
createRedisDriver()
Create an instance of the Redis session driver.
at line 134
protected Store
buildSession(SessionHandlerInterface $handler)
Build the session instance.
at line 149
protected EncryptedStore
buildEncryptedSession(SessionHandlerInterface $handler)
Build the encrypted session instance.
at line 163
bool
supportsUserSessionManagement()
Determine if the configured driver supports user session management.
at line 176
UserSessions
forUser(Authenticatable|int|string $user, UnitEnum|string|null $guard = null)
Get a user-scoped session repository.
at line 243
bool
shouldBlock()
Determine if requests for the same session should wait for each to finish before executing.
at line 251
string|null
blockDriver()
Get the name of the cache store / driver that should be used to acquire session locks.
at line 259
int
defaultRouteBlockLockSeconds()
Get the maximum number of seconds the session lock should be held for.
at line 267
int
defaultRouteBlockWaitSeconds()
Get the maximum number of seconds to wait while attempting to acquire a route block session lock.
at line 275
array
getSessionConfig()
Get the session configuration.
at line 293
void
setDefaultDriver(UnitEnum|string $name)
Set the default session driver name.
Boot-only. Mutates process-global config; per-request use races across coroutines.