Download the PHP package utopia-php/validators without Composer
On this page you can find all versions of the php package utopia-php/validators. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download utopia-php/validators
More information about utopia-php/validators
Files in utopia-php/validators
Package validators
Short Description A lightweight collection of reusable validators for Utopia projects
License MIT
Informations about the package validators
Utopia Validators
[!IMPORTANT] This repository is a read-only mirror of
packages/validatorsin appwrite/appwrite. Development happens there — please open issues and pull requests against appwrite/appwrite.
Reusable validation building blocks for Utopia projects.
This package exposes a consistent API for common HTTP-oriented validation concerns such as input sanitization, URL checks, IP validation, hostname filtering, lists enforcement, and more.
Installation
Usage
Validators expose a predictable contract:
isValid(mixed $value): bool– core validation rulegetDescription(): string– human readable rule summarygetType(): string– expected PHP type (string, integer, array, ...)isArray(): bool– hint whether the validator expects an array input
For advanced flows combine validators with Multiple, AnyOf, AllOf, NoneOf, or wrap checks with helpers such as Nullable.
Available Validators
AllOf,AnyOf,NoneOf,Multiple– composition helpersArrayList,Assoc,Nullable,WhiteList,WildcardBoolean,Integer,FloatValidator,Numeric,RangeDomain,Host,Hostname,IP,Port,URLHexColor,Identifier,JSON,Phone,TextJSON\ObjectValidator,JSON\ArrayValidator– JSON shape checks that accept encoded stringsJSON\FCM– FCM service account JSON with required credential fields
Validating JSON shape
JSON accepts any valid JSON, including scalars such as "1" and "\"text\"". When a parameter must be
an object or a list, reach for the shape-specific validators instead. Both accept a value that is already
decoded or still encoded as a string:
Strings decode to objects rather than associative arrays, so '{}' and '[]' stay distinguishable. A value
that arrives already decoded as an empty array is ambiguous — PHP represents both {} and [] that way — so
both validators accept it.
Use JSON\FCM for Google service account credentials used with the FCM HTTP v1 API. It accepts an encoded
JSON object, associative array, or stdClass. The validator checks the credential type, Firebase project,
service account email, PEM private key, and OAuth token endpoint. It also validates standard optional service
account fields when present.
Development
Run the static analysis and test suites from the project root:
This project is released under the MIT License.