Skip to content

InMemoryUserProvider

A config-driven UserProviderInterface, for apps with a small, static user list (the security.xml <provider type="in_memory"> shape).

final class InMemoryUserProvider implements UserProviderInterface

ImplementsUserProviderInterface
Since1.0.0
SourceProvider/InMemoryUserProvider.php

public function __construct(array<string, array{password_hash: string, roles?: array<int, string>}> $users): mixed

Keyed by identifier (e.g. email/username).

ParameterTypeDescription
$usersarray``<``string``, ``array{password_hash: string, roles?: array<int, string>}``>Keyed by identifier (e.g. email/username).

Returns mixed

MethodDescription
loadByIdentifier(string $identifier): ?UserIdentity
loadByToken(TokenClaims $claims): null

public function loadByIdentifier(string $identifier): ?UserIdentity

E.g. an email or username.

ParameterTypeDescription
$identifierstringE.g. an email or username.

Returns ?UserIdentity — Null if no matching identity exists.

public function loadByToken(TokenClaims $claims): null

The validated token claims.

ParameterTypeDescription
$claimsTokenClaimsThe validated token claims.

Returns null — Always null: a static, config-driven user list has no token/claim mapping; token-derived identity resolution belongs to a Pdo/CallableUserProvider.