Skip to content

FileSessionFactory

The default session slot factory: file-backed, zero dependencies, no database required.

Suitable for a single host or any deployment with a shared filesystem; for multiple hosts without one, configure a PDO, Redis or object-storage backed factory instead.

Parameters: dir (defaults to core.app_dir/cache/sessions), plus whatever FileSessionPersistence accepts (idle_ttl, gc_probability, gc_divisor).

final class FileSessionFactory implements SessionFactoryInterface

ImplementsSessionFactoryInterface
Since2.2.0
SourceSession/FileSessionFactory.php
MethodDescription
createPersistence(Context $context, array $parameters): SessionPersistenceInterfaceBuilds a FileSessionPersistence over the configured directory.

public function createPersistence(Context $context, array $parameters): SessionPersistenceInterface

Builds a FileSessionPersistence over the configured directory.

A missing or non-string dir parameter falls back to core.app_dir/cache/sessions, and core.app_dir in turn to the system temp directory. The remaining parameters are passed through untouched.

ParameterTypeDescription
$contextContext
$parametersarray

Returns SessionPersistenceInterface

ThrowsWhen
StorageExceptionif the directory cannot be created or is not writable.