FileSessionStore
A session ledger on disk — the persistent counterpart of {@see InMemorySessionStore}, so a session minted in one request is still there in the next. {@see InMemorySessionStore} is enough within a single process (a test, a long-lived worker); a real HTTP login spans separate PHP processes, and needs its sessions to outlive the request that made them. This holds the same fail-closed contract — an expired or revoked record reads as absent, never as a live actor — over a JSON file with locked writes, mirroring the framework's other file stores.
FileSessionStore::__construct()
public function __construct(string $path, ?callable $clock = null):Parameters
| Name | Type | Description |
|---|---|---|
| $path | string | |
| $clock | (callable(): \DateTimeImmutable | null) | the clock expiry is evaluated against |
FileSessionStore::read()
public function read(string $sessionId): ?Milpa\Auth\SessionRecordThe live session under this id, or null when none is stored, or it is expired or revoked (fail-closed).
Parameters
| Name | Type | Description |
|---|---|---|
| $sessionId | string |
FileSessionStore::write()
public function write(Milpa\Auth\SessionRecord $session): voidPersist a session on disk, keyed by its id, under an exclusive lock.
Parameters
| Name | Type | Description |
|---|---|---|
| $session | Milpa\Auth\SessionRecord |
FileSessionStore::destroy()
public function destroy(string $sessionId): voidRemove the session under this id; a no-op when none is stored.
Parameters
| Name | Type | Description |
|---|---|---|
| $sessionId | string |