Factory
class Factory implements Factory
Properties
| protected PresenceVerifierInterface|null | $verifier | The Presence Verifier implementation. |
|
| protected Closure|string> | $extensions | All of the custom validator extensions. |
|
| protected Closure|string> | $implicitExtensions | All of the custom implicit validator extensions. |
|
| protected Closure|string> | $dependentExtensions | All of the custom dependent validator extensions. |
|
| protected Closure|string> | $replacers | All of the custom validator message replacers. |
|
| protected array<string, string> | $fallbackMessages | All of the fallback messages for custom rules. |
|
| protected bool | $excludeUnvalidatedArrayKeys | Indicates that unvalidated array keys should be excluded, even if the parent array was validated. |
|
| protected Closure|null | $resolver | The Validator resolver instance. |
Methods
Create a new Validator factory instance.
Create a new Validator instance.
Validate the given data against the provided rules.
Resolve a new Validator instance.
Register a custom implicit validator extension.
Register a custom dependent validator extension.
Indicate that unvalidated array keys should be included in validated data when the parent array is validated.
Indicate that unvalidated array keys should be excluded from the validated data, even if the parent array was validated.
Fake the DNS lookups performed by validation rules so they always succeed.
Get the Translator implementation.
Get the Presence Verifier implementation.
Set the Presence Verifier implementation.
Get the container instance used by the validation factory.
Details
at line 73
__construct(Translator $translator, Container|null $container = null)
Create a new Validator factory instance.
at line 82
Validator
make(array $data, array $rules, array $messages = [], array $attributes = [])
Create a new Validator instance.
at line 117
array
validate(array $data, array $rules, array $messages = [], array $attributes = [])
Validate the given data against the provided rules.
at line 125
protected Validator
resolve(array $data, array $rules, array $messages, array $attributes)
Resolve a new Validator instance.
at line 137
protected void
addExtensions(Validator $validator)
Add the extensions to a validator instance.
at line 159
void
extend(string $rule, Closure|string $extension, string|null $message = null)
Register a custom validator extension.
On the shared factory, the extension persists for the worker lifetime and applies to validators built by every concurrent request.
at line 175
void
extendImplicit(string $rule, Closure|string $extension, string|null $message = null)
Register a custom implicit validator extension.
On the shared factory, the extension persists for the worker lifetime and applies to validators built by every concurrent request.
at line 191
void
extendDependent(string $rule, Closure|string $extension, string|null $message = null)
Register a custom dependent validator extension.
On the shared factory, the extension persists for the worker lifetime and applies to validators built by every concurrent request.
at line 207
void
replacer(string $rule, Closure|string $replacer)
Register a custom validator message replacer.
On the shared factory, the message replacer persists for the worker lifetime and applies to validators built by every concurrent request.
at line 219
void
includeUnvalidatedArrayKeys()
Indicate that unvalidated array keys should be included in validated data when the parent array is validated.
On the shared factory, the setting persists for the worker lifetime and can change validated-data shape for validators built by concurrent requests.
at line 231
void
excludeUnvalidatedArrayKeys()
Indicate that unvalidated array keys should be excluded from the validated data, even if the parent array was validated.
On the shared factory, the setting persists for the worker lifetime and can change validated-data shape for validators built by concurrent requests.
at line 243
void
fakeDnsLookups(bool $value = true)
Fake the DNS lookups performed by validation rules so they always succeed.
The setting persists for the worker lifetime; failing to reset it through Validator::flushState() can make later tests bypass real DNS validation.
at line 255
void
resolver(Closure $resolver)
Set the Validator instance resolver.
On the shared factory, the resolver persists for the worker lifetime and can change the Validator class used by concurrent builds.
at line 264
Translator
getTranslator()
Get the Translator implementation.
at line 272
PresenceVerifierInterface|null
getPresenceVerifier()
Get the Presence Verifier implementation.
at line 283
void
setPresenceVerifier(PresenceVerifierInterface $presenceVerifier)
Set the Presence Verifier implementation.
On the shared factory, the verifier persists for the worker lifetime and can route concurrent exists and unique checks through the wrong verifier.
at line 292
Container|null
getContainer()
Get the container instance used by the validation factory.