twentytwo-labs / array-comparator
Installs: 1 051
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=8.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.8
- infection/infection: ^0.28
- phpmd/phpmd: ^2.12
- phpstan/phpstan: ^1.11
- phpstan/phpstan-deprecation-rules: ^1.2
- phpstan/phpstan-phpunit: ^1.4
- phpunit/phpunit: ^10.0
- squizlabs/php_codesniffer: ^3.10
README
This library can validate array in recursive. If one or more fields not match, there is an exception
In some cases the need for more advanced matching arises. All custom functions is used in place of the string value they are validating
<array>
- Match only if value is an array or json object
<date>
- Regex
^[0-9]{4}-[0-9]{2}-[0-9]{2}$
- Ex:
2022-06-01
- Regex
<dateTime>
- regex
^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\+[0-9]{2}:[0-9]{2}$
- Ex:
2021-09-22T14:45:59+02:00
- regex
<int>
- Match only if value is an integer
- Ex:
3
<string>
- Match only if value is a string
- Ex:
"Foo"
<uuid>
- Match only if value is an uuid