{"id":16199262,"url":"https://github.com/sandromiguel/verum-php","last_synced_at":"2025-10-11T10:18:25.909Z","repository":{"id":45663904,"uuid":"275114923","full_name":"SandroMiguel/verum-php","owner":"SandroMiguel","description":"Server-Side Validation Library for PHP","archived":false,"fork":false,"pushed_at":"2025-02-28T17:45:26.000Z","size":33863,"stargazers_count":18,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-16T03:21:18.254Z","etag":null,"topics":["php","php-library","validation","validator"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SandroMiguel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-26T09:03:18.000Z","updated_at":"2025-02-28T17:45:29.000Z","dependencies_parsed_at":"2024-10-21T22:26:59.495Z","dependency_job_id":null,"html_url":"https://github.com/SandroMiguel/verum-php","commit_stats":{"total_commits":163,"total_committers":5,"mean_commits":32.6,"dds":0.07975460122699385,"last_synced_commit":"c9c88165d42b03d24e99f8084bdf3fb18088ae0c"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/SandroMiguel/verum-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SandroMiguel%2Fverum-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SandroMiguel%2Fverum-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SandroMiguel%2Fverum-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SandroMiguel%2Fverum-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SandroMiguel","download_url":"https://codeload.github.com/SandroMiguel/verum-php/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SandroMiguel%2Fverum-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006841,"owners_count":26084204,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php","php-library","validation","validator"],"created_at":"2024-10-10T09:24:49.198Z","updated_at":"2025-10-11T10:18:25.888Z","avatar_url":"https://github.com/SandroMiguel.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"http://sandromiguel.com/host/verum-php.png\" alt=\"Verum PHP\" /\u003e\u003c/p\u003e\n\n[![License](https://poser.pugx.org/sandromiguel/verum-php/license)](//packagist.org/packages/sandromiguel/verum-php)\n[![Latest Stable Version](https://poser.pugx.org/sandromiguel/verum-php/v)](//packagist.org/packages/sandromiguel/verum-php)\n[![Dependents](https://poser.pugx.org/sandromiguel/verum-php/dependents)](//packagist.org/packages/sandromiguel/verum-php)\n\n# Verum PHP\n\nVerum PHP is a server-side validation library for PHP that allows you to validate arrays (with file support) with ease. It comes with custom error messages, rules, built-in translations, and zero dependencies.\n\n**Server-Side Validation Library for PHP**\n\n-   Validate arrays (with file support)\n-   Custom error messages\n-   Custom rules\n-   Built-in translations\n-   Zero dependencies\n\n## Table of Contents\n\n1. [Getting Started](#getting-started)\n1. [Usage](#usage)\n1. [Custom validations](#custom-validations)\n1. [Available Rules](#available-rules)\n1. [Contributing](#contributing)\n1. [Questions](#questions)\n1. [License](#license)\n\n## Getting Started\n\n### Installation\n\nInstall Verum PHP with Composer\n\n```sh\ncomposer require sandromiguel/verum-php\n```\n\n### Usage\n\n#### Simple usage example\n\nValidate a simple registration form (name, email and age)\n\n```php\nuse Verum\\Validator;\n\n$rules = [\n    'name' =\u003e [\n        'rules' =\u003e [\n            'required',\n        ],\n    ],\n    'email' =\u003e [\n        'rules' =\u003e [\n            'required',\n            'email',\n        ],\n    ],\n    'age' =\u003e [\n        'rules' =\u003e [\n            'numeric',\n        ],\n    ],\n];\n\n$validator = new Validator($_POST, $rules);\n\necho json_encode(\n    [\n        'valid'  =\u003e $validator-\u003evalidate(),\n        'errors' =\u003e $validator-\u003egetErrors(),\n    ]\n);\n```\n\n##### Valid form example\n\nInput:\n\n```json\n[\n    'name' =\u003e 'John Doe',\n    'email' =\u003e 'johndoe@example.com',\n    'age' =\u003e '20',\n]\n```\n\nOutput:\n\n```json\n{\n    \"valid\": true,\n    \"errors\": []\n}\n```\n\n##### Invalid form example\n\nInput:\n\n```json\n[\n    'name' =\u003e '',\n    'email' =\u003e 'some text',\n    'age' =\u003e 'some text',\n]\n```\n\nOutput:\n\n```json\n{\n    \"valid\": false,\n    \"errors\": {\n        \"name\": {\n            \"label\": null,\n            \"rules\": {\n                \"required\": \"This field is required.\"\n            }\n        },\n        \"email\": {\n            \"label\": null,\n            \"rules\": {\n                \"email\": \"This field must be a valid email address.\"\n            }\n        },\n        \"age\": {\n            \"label\": null,\n            \"rules\": {\n                \"numeric\": \"This field must be numeric.\"\n            }\n        }\n    }\n}\n```\n\n#### Use `RuleEnum` class\n\nYou can use the `RuleEnum` class to access all rule names.\n\n```php\nuse Verum\\Validator;\nuse Verum\\Enum\\RuleEnum;\n\n$rules = [\n    'name' =\u003e [\n        'rules' =\u003e [\n            RuleEnum::REQUIRED,\n        ],\n    ],\n    ...\n];\n```\n\n#### Specify the fields label (naming inputs)\n\n```php\n$rules = [\n    'name' =\u003e [\n        'label' =\u003e 'Name',\n        'rules' =\u003e [\n            RuleEnum::REQUIRED,\n        ],\n    ],\n    ...\n];\n```\n\nOutput:\n\n```json\n{\n    ...\n    \"errors\": {\n        \"name\": {\n            \"label\": \"Name\",\n            \"rules\": {\n                \"required\": 'The \"Name\" field is required.'\n            }\n        },\n        ...\n    }\n}\n```\n\n#### Specify field labels for each language\n\n```php\n$rules = [\n    'name' =\u003e [\n        'label' =\u003e [\n            'en' =\u003e 'Name',\n            'pt-pt' =\u003e 'Nome',\n        ],\n        'rules' =\u003e [\n            RuleEnum::REQUIRED,\n        ],\n    ],\n    ...\n];\n```\n\nOutput (pt-pt):\n\n```json\n{\n    ...\n    \"errors\": {\n        \"name\": {\n            \"label\": \"Nome\",\n            \"rules\": {\n                \"required\": 'O campo \"Nome\" é obrigatório.'\n            }\n        },\n        ...\n    }\n}\n```\n\n#### Specify the messages language\n\nYou can use some built-in translations:\n\n-   `'en'` -\u003e English (default)\n-   `'nl-nl'` -\u003e Dutch\n-   `'pt-pt'` -\u003e Portuguese-Portugal\n-   `'pt-br'` -\u003e Portuguese-Brazil\n\n```php\n$validator = new Validator($_POST, $rules, 'pt-pt');\n```\n\n#### Specify the messages language using the `LangEnum` class\n\n```php\nuse Verum\\Validator;\nuse Verum\\Enum\\LangEnum;\n\n...\n\n$validator = new Validator($_POST, $rules, LangEnum::PT_PT);\n```\n\n#### Specify a custom error message\n\n-   Useful to override the default error message.\n-   Useful for localization.\n\n```php\n...\n$validator = new Validator($_POST, $rules);\n$validator-\u003eaddSimpleCustomMessage('min_length', 'Min Length rule custom error message');\n...\n```\n\nOutput example:\n\n```json\n{\n    ...\n    \"errors\": {\n        \"name\": {\n            \"label\": \"Name\",\n            \"rules\": {\n                \"min_length\": \"Min Length rule custom error message\"\n            }\n        },\n        ...\n    }\n}\n```\n\n#### Specify a custom error message with placeholders\n\n```php\n...\n$validator = new Validator($_POST, $rules);\n$validator-\u003eaddSimpleCustomMessage('min_length', 'Number of characters detected: {param:1}. Field name: \"{param:2}\".');\n...\n```\n\nOutput example:\n\n```json\n{\n    ...\n    \"errors\": {\n        \"name\": {\n            \"label\": \"Name\",\n            \"rules\": {\n                \"min_length\": 'Number of characters detected: 5. Field name: \"Name\".'\n            }\n        },\n        ...\n    }\n}\n```\n\n#### Specify a custom error message for fields with and without a label\n\n```php\n...\n$validator = new Validator($_POST, $rules);\n$validator-\u003eaddCustomMessage(\n    'required',\n    'Custom error message with label for required rule. Label: {param:1}.',\n    'Custom error message without label for required rule.'\n);\n...\n```\n\nOutput - Field with label:\n\n```json\n{\n    ...\n    \"errors\": {\n        \"name\": {\n            \"label\": \"Name\",\n            \"rules\": {\n                \"required\": 'Custom error message with label for required rule. Label: Name.'\n            }\n        },\n        ...\n    }\n}\n```\n\nOutput - Field without label:\n\n```json\n{\n    ...\n    \"errors\": {\n        \"name\": {\n            \"label\": null,\n            \"rules\": {\n                \"required\": \"Custom error message without label for required rule.\"\n            }\n        },\n        ...\n    }\n}\n```\n\n#### Specify multiple custom error messages at once\n\n```php\n...\n$validator = new Validator($_POST, $rules);\n$validator-\u003eaddCustomMessages(\n    [\n        'min_length' =\u003e 'Custom message for the \"min_length\" rule.',\n        'required' =\u003e 'Custom message for the \"required\" rule.',\n        // other messages ...\n    ]\n);\n...\n```\n\n#### Specify multiple custom error messages at once for fields with and without a label\n\n```php\n...\n$validator = new Validator($_POST, $rules);\n$validator-\u003eaddCustomMessages(\n    [\n        'numeric' =\u003e [\n            'withLabel' =\u003e 'Custom message with label for \"numeric\" rule. Label: {param:1}.',\n            'withoutLabel' =\u003e 'Custom message without label for \"numeric\" rule.',\n        ],\n        'min_length' =\u003e [\n            'withLabel' =\u003e 'Custom message with label for \"min_length\" rule. Label: {param:2}, value: {param:1}.',\n            'withoutLabel' =\u003e 'Custom message without label for \"min_length\" rule. Value: {param:1}.',\n        ],\n        // other messages ...\n    ]\n);\n...\n```\n\n#### Handling Multi-Name Fields\n\nWith Verum PHP, you can handle multi-name fields more effectively. These are fields that include language identifiers or other variations in their names. For example, if you have fields like `title.en`, `title.pt`, `description.en`, and `description.pt`, you can specify rules for them using wildcards or by targeting specific fields.\n\n##### Using Wildcards to Apply Rules to All Variants\n\nYou can define rules for all variants of a field using the `*` wildcard. For example:\n\n```php\n$rules = [\n    'title.*' =\u003e [\n        'rules' =\u003e [\n            RuleEnum::REQUIRED,\n        ],\n    ],\n    'description.*' =\u003e [\n        'rules' =\u003e [\n            RuleEnum::REQUIRED,\n            RuleEnum::MIN_LENGTH =\u003e 10,\n        ],\n    ],\n];\n\n$validator = new Validator($_POST, $rules);\n// ...\n```\n\nOutput example:\n\n```json\n{\n    \"valid\": false,\n    \"errors\": {\n        \"title.en\": {\n            \"label\": null,\n            \"rules\": {\n                \"required\": \"This field is required.\"\n            }\n        },\n        \"title.pt\": {\n            \"label\": null,\n            \"rules\": {\n                \"required\": \"This field is required.\"\n            }\n        },\n        \"description.en\": {\n            \"label\": null,\n            \"rules\": {\n                \"required\": \"This field is required.\",\n                \"min_length\": \"This field must be at least 10 characters long.\"\n            }\n        },\n        \"description.pt\": {\n            \"label\": null,\n            \"rules\": {\n                \"required\": \"This field is required.\",\n                \"min_length\": \"This field must be at least 10 characters long.\"\n            }\n        }\n    }\n}\n```\n\n##### Validating Specific Variants\n\nIf you only want to validate a specific variant of a field, you can target it directly. For example, to validate only the English title and make titles in other languages optional:\n\n```php\n$rules = [\n    'title.en' =\u003e [\n        'rules' =\u003e [\n            RuleEnum::REQUIRED,\n        ],\n    ],\n];\n\n$validator = new Validator($_POST, $rules);\n// ...\n```\n\nOutput example:\n\n```json\n{\n    \"valid\": false,\n    \"errors\": {\n        \"title.en\": {\n            \"label\": null,\n            \"rules\": {\n                \"required\": \"This field is required.\"\n            }\n        }\n    }\n}\n```\n\nThis allows you to apply rules more precisely, ensuring flexibility in how multi-name fields are handled based on your application's needs.\n\n## Custom validations\n\nYou can use your custom validations and inject the error message.\n\n```php\nif ($myCustomValidationFail) {\n    $validator-\u003eaddError(\n        'someFieldName',\n        'Some field name',\n        ['no_duplicate' =\u003e 'A user already exists with that username')]\n    );\n    // ...\n}\n```\n\n## Available Rules\n\n1. [alpha](#alpha)\n1. [alpha_numeric](#alpha_numeric)\n1. [between](#between)\n1. [between_length](#between_length)\n1. [boolean_value](#boolean_value)\n1. [contains](#contains)\n1. [date](#date)\n1. [email](#email)\n1. [equals](#equals)\n1. [file_max_size](#file_max_size)\n1. [file_mime_type](#file_mime_type)\n1. [float_number](#float_number)\n1. [image_max_height](#image_max_height)\n1. [image_max_width](#image_max_width)\n1. [image_min_height](#image_min_height)\n1. [image_min_width](#image_min_width)\n1. [integer](#integer)\n1. [ip](#ip)\n1. [ipv4](#ipv4)\n1. [ipv6](#ipv6)\n1. [max](#max)\n1. [max_length](#max_length)\n1. [min](#min)\n1. [min_length](#min_length)\n1. [numeric](#numeric)\n1. [regex](#regex)\n1. [required](#required)\n1. [slug](#slug)\n1. [url](#url)\n\n### alpha\n\nChecks whether the value contains only alphabetic characters.\n\n```php\n$rules = [\n    'nickname' =\u003e [\n        'label' =\u003e 'Nickname',\n        'rules' =\u003e [\n            RuleEnum::ALPHA,\n        ],\n    ],\n];\n```\n\n| Value                |       alpha        |  alpha + required  |\n| -------------------- | :----------------: | :----------------: |\n| `null`               | :heavy_check_mark: |        :x:         |\n| `''`                 | :heavy_check_mark: |        :x:         |\n| `'0'`                |        :x:         |        :x:         |\n| `0`                  |        :x:         |        :x:         |\n| `false`              |        :x:         |        :x:         |\n| `[]`                 |        :x:         |        :x:         |\n| `-1`                 |        :x:         |        :x:         |\n| `1`                  |        :x:         |        :x:         |\n| `true`               |        :x:         |        :x:         |\n| `'text'`             | :heavy_check_mark: | :heavy_check_mark: |\n| `'text with spaces'` |        :x:         |        :x:         |\n\n### alpha_numeric\n\nChecks whether the value contains only alphanumeric characters.\n\n```php\n$rules = [\n    'nickname' =\u003e [\n        'label' =\u003e 'Nickname',\n        'rules' =\u003e [\n            RuleEnum::ALPHA_NUMERIC,\n        ],\n    ],\n];\n```\n\n| Value                |   alpha_numeric    | alpha_numeric + required |\n| -------------------- | :----------------: | :----------------------: |\n| `null`               | :heavy_check_mark: |           :x:            |\n| `''`                 | :heavy_check_mark: |           :x:            |\n| `'0'`                | :heavy_check_mark: |    :heavy_check_mark:    |\n| `0`                  | :heavy_check_mark: |    :heavy_check_mark:    |\n| `false`              |        :x:         |           :x:            |\n| `[]`                 |        :x:         |           :x:            |\n| `-1`                 |        :x:         |           :x:            |\n| `1`                  | :heavy_check_mark: |    :heavy_check_mark:    |\n| `true`               |        :x:         |           :x:            |\n| `'text'`             | :heavy_check_mark: |    :heavy_check_mark:    |\n| `'text with spaces'` |        :x:         |           :x:            |\n\n### between\n\nChecks whether the value is between two values.\n\n```php\n$rules = [\n    'age' =\u003e [\n        'label' =\u003e 'Age',\n        'rules' =\u003e [\n            RuleEnum::BETWEEN =\u003e [12, 29],\n        ],\n    ],\n];\n```\n\n| Value         |  between [1, 10]   | between [1, 10] + required |\n| ------------- | :----------------: | :------------------------: |\n| `null`        | :heavy_check_mark: |            :x:             |\n| `''`          | :heavy_check_mark: |            :x:             |\n| `'0'`         |        :x:         |            :x:             |\n| `0`           |        :x:         |            :x:             |\n| `false`       |        :x:         |            :x:             |\n| `[]`          |        :x:         |            :x:             |\n| `-1`          |        :x:         |            :x:             |\n| `1`           | :heavy_check_mark: |     :heavy_check_mark:     |\n| `true`        |        :x:         |            :x:             |\n| `'some text'` |        :x:         |            :x:             |\n\n### between_length\n\nChecks whether the number of characters of the value is between min and max values.\n\n```php\n$rules = [\n    'nickname' =\u003e [\n        'label' =\u003e 'Nickname',\n        'rules' =\u003e [\n            RuleEnum::BETWEEN_LENGTH =\u003e [3, 15],\n        ],\n    ],\n];\n```\n\n| Value                       | between_length [5,25] | between_length [5,25] + required |\n| --------------------------- | :-------------------: | :------------------------------: |\n| `null`                      |  :heavy_check_mark:   |               :x:                |\n| `''`                        |  :heavy_check_mark:   |               :x:                |\n| `'0'`                       |          :x:          |               :x:                |\n| `0`                         |          :x:          |               :x:                |\n| `false`                     |          :x:          |               :x:                |\n| `[]`                        |          :x:          |               :x:                |\n| `-1`                        |          :x:          |               :x:                |\n| `1`                         |          :x:          |               :x:                |\n| `12345`                     |  :heavy_check_mark:   |        :heavy_check_mark:        |\n| `true`                      |          :x:          |               :x:                |\n| `'text'`                    |          :x:          |               :x:                |\n| `'text with 23 characters'` |  :heavy_check_mark:   |        :heavy_check_mark:        |\n\n### boolean_value\n\nChecks whether the value is a boolean value.\nReturns true for 1/0, '1'/'0', 'on'/'off', 'yes'/'no', true/false.\n\n```php\n$rules = [\n    'light' =\u003e [\n        'label' =\u003e 'Light',\n        'rules' =\u003e [\n            RuleEnum::BOOLEAN_VALUE,\n        ],\n    ],\n];\n```\n\n| Value    |   boolean_value    | boolean_value + required |\n| -------- | :----------------: | :----------------------: |\n| `null`   | :heavy_check_mark: |           :x:            |\n| `''`     | :heavy_check_mark: |           :x:            |\n| `'0'`    | :heavy_check_mark: |    :heavy_check_mark:    |\n| `0`      | :heavy_check_mark: |    :heavy_check_mark:    |\n| `false`  | :heavy_check_mark: |    :heavy_check_mark:    |\n| `[]`     |        :x:         |           :x:            |\n| `-1`     |        :x:         |           :x:            |\n| `'1'`    | :heavy_check_mark: |    :heavy_check_mark:    |\n| `1`      | :heavy_check_mark: |    :heavy_check_mark:    |\n| `true`   | :heavy_check_mark: |    :heavy_check_mark:    |\n| `'text'` |        :x:         |           :x:            |\n| `'on'`   | :heavy_check_mark: |    :heavy_check_mark:    |\n| `'off'`  | :heavy_check_mark: |    :heavy_check_mark:    |\n| `'yes'`  | :heavy_check_mark: |    :heavy_check_mark:    |\n| `'no' `  | :heavy_check_mark: |    :heavy_check_mark:    |\n\n### contains\n\nChecks whether the value is in an array.\n\n```php\n$rules = [\n    'priority' =\u003e [\n        'label' =\u003e 'Priority',\n        'rules' =\u003e [\n            RuleEnum::CONTAINS =\u003e ['low', 'high'],\n        ],\n    ],\n];\n```\n\n| Value    | contains ['low','high'] | contains ['low','high'] + required |\n| -------- | :---------------------: | :--------------------------------: |\n| `null`   |   :heavy_check_mark:    |                :x:                 |\n| `''`     |   :heavy_check_mark:    |                :x:                 |\n| `'0'`    |           :x:           |                :x:                 |\n| `0`      |           :x:           |                :x:                 |\n| `false`  |           :x:           |                :x:                 |\n| `[]`     |           :x:           |                :x:                 |\n| `-1`     |           :x:           |                :x:                 |\n| `1`      |           :x:           |                :x:                 |\n| `true`   |           :x:           |                :x:                 |\n| `'text'` |           :x:           |                :x:                 |\n| `'low'`  |   :heavy_check_mark:    |         :heavy_check_mark:         |\n| `'high'` |   :heavy_check_mark:    |         :heavy_check_mark:         |\n\n### date\n\nChecks whether the value is a valid date (Y-m-d) or a custom format.\n\n#### Default format (Y-m-d)\n\n```php\n$rules = [\n    'dob' =\u003e [\n        'label' =\u003e 'Date of birth',\n        'rules' =\u003e [\n            RuleEnum::DATE,\n        ],\n    ],\n];\n```\n\n#### Custom format (e.g. d.m.Y)\n\n```php\n$rules = [\n    'dob' =\u003e [\n        'label' =\u003e 'Date of birth',\n        'rules' =\u003e [\n            RuleEnum::DATE =\u003e ['d.m.Y'],\n        ],\n    ],\n];\n```\n\n| Value          |    date [Y-m-d]    | date [Y-m-d] + required |\n| -------------- | :----------------: | :---------------------: |\n| `null`         | :heavy_check_mark: |           :x:           |\n| `''`           | :heavy_check_mark: |           :x:           |\n| `'0'`          |        :x:         |           :x:           |\n| `0`            |        :x:         |           :x:           |\n| `false`        |        :x:         |           :x:           |\n| `[]`           |        :x:         |           :x:           |\n| `-1`           |        :x:         |           :x:           |\n| `1`            |        :x:         |           :x:           |\n| `true`         |        :x:         |           :x:           |\n| `'text'`       |        :x:         |           :x:           |\n| `'2020-09-30'` | :heavy_check_mark: |   :heavy_check_mark:    |\n\n### email\n\nChecks whether the value has a valid email format.\n\n```php\n$rules = [\n    'email' =\u003e [\n        'label' =\u003e 'Email',\n        'rules' =\u003e [\n            RuleEnum::EMAIL,\n        ],\n    ],\n];\n```\n\n| Value                |       email        |  email + required  |\n| -------------------- | :----------------: | :----------------: |\n| `null`               | :heavy_check_mark: |        :x:         |\n| `''`                 | :heavy_check_mark: |        :x:         |\n| `'0'`                |        :x:         |        :x:         |\n| `0`                  |        :x:         |        :x:         |\n| `false`              |        :x:         |        :x:         |\n| `[]`                 |        :x:         |        :x:         |\n| `-1`                 |        :x:         |        :x:         |\n| `1`                  |        :x:         |        :x:         |\n| `true`               |        :x:         |        :x:         |\n| `'text'`             |        :x:         |        :x:         |\n| `'john@example.com'` | :heavy_check_mark: | :heavy_check_mark: |\n\n### equals\n\nChecks whether the value is equal to another.\n\n```php\n$rules = [\n    'repeat_password' =\u003e [\n        'label' =\u003e 'Repeat Password',\n        'rules' =\u003e [\n            RuleEnum::EQUALS =\u003e ['password'],\n        ],\n    ],\n];\n```\n\nComparison with `'text'`\n\n| Value            |       equals       | equals + required  |\n| ---------------- | :----------------: | :----------------: |\n| `null`           | :heavy_check_mark: |        :x:         |\n| `''`             | :heavy_check_mark: |        :x:         |\n| `'0'`            |        :x:         |        :x:         |\n| `0`              |        :x:         |        :x:         |\n| `false`          |        :x:         |        :x:         |\n| `[]`             |        :x:         |        :x:         |\n| `-1`             |        :x:         |        :x:         |\n| `1`              |        :x:         |        :x:         |\n| `true`           |        :x:         |        :x:         |\n| `'text'`         | :heavy_check_mark: | :heavy_check_mark: |\n| `'another text'` |        :x:         |        :x:         |\n\n### file_max_size\n\nChecks whether the file size does not exceed a given value.\n\nEnter a value in bytes.\n\n```php\n$rules = [\n    'profile_photo' =\u003e [\n        'label' =\u003e 'Profile Photo',\n        'rules' =\u003e [\n            RuleEnum::FILE_MAX_SIZE =\u003e [102400],\n        ],\n    ],\n];\n```\n\nComparison with `102400` bytes\n\n| Value    |   file_max_size    | file_max_size + required |\n| -------- | :----------------: | :----------------------: |\n| `null`   | :heavy_check_mark: |           :x:            |\n| `50000`  | :heavy_check_mark: |    :heavy_check_mark:    |\n| `150000` |        :x:         |           :x:            |\n\n### file_mime_type\n\nChecks whether the file type is allowed.\n\n```php\n$rules = [\n    'profile_photo' =\u003e [\n        'label' =\u003e 'Profile Photo',\n        'rules' =\u003e [\n            RuleEnum::FILE_MIME_TYPE =\u003e ['image/png', 'image/jpeg'],\n        ],\n    ],\n];\n```\n\n| Value        |   file_mime_type   | file_mime_type + required |\n| ------------ | :----------------: | :-----------------------: |\n| `null`       | :heavy_check_mark: |            :x:            |\n| `image/png`  | :heavy_check_mark: |    :heavy_check_mark:     |\n| `text/plain` |        :x:         |            :x:            |\n\n### float_number\n\nChecks whether the value is a floating point number.\n\n```php\n$rules = [\n    'price' =\u003e [\n        'label' =\u003e 'Price',\n        'rules' =\u003e [\n            RuleEnum::FLOAT_NUMBER,\n        ],\n    ],\n];\n```\n\n| Value                |    float_number    | float_number + required |\n| -------------------- | :----------------: | :---------------------: |\n| `null`               | :heavy_check_mark: |           :x:           |\n| `''`                 | :heavy_check_mark: |           :x:           |\n| `'0'`                |        :x:         |           :x:           |\n| `0`                  |        :x:         |           :x:           |\n| `false`              |        :x:         |           :x:           |\n| `[]`                 |        :x:         |           :x:           |\n| `-1`                 |        :x:         |           :x:           |\n| `1`                  |        :x:         |           :x:           |\n| `12345`              |        :x:         |           :x:           |\n| `123.45`             | :heavy_check_mark: |   :heavy_check_mark:    |\n| `true`               |        :x:         |           :x:           |\n| `'text'`             |        :x:         |           :x:           |\n| `'text with spaces'` |        :x:         |           :x:           |\n\n### image_max_height\n\nChecks whether the image height does not exceed a given value.\n\n```php\n$rules = [\n    'profile_photo' =\u003e [\n        'label' =\u003e 'Profile Photo',\n        'rules' =\u003e [\n            RuleEnum::IMAGE_MAX_HEIGHT =\u003e [600],\n        ],\n    ],\n];\n```\n\n| Value  |  image_max_height  | image_max_height + required |\n| ------ | :----------------: | :-------------------------: |\n| `null` | :heavy_check_mark: |             :x:             |\n| 500px  | :heavy_check_mark: |     :heavy_check_mark:      |\n| 1000px |        :x:         |             :x:             |\n\n### image_max_width\n\nChecks whether the image width does not exceed a given value.\n\n```php\n$rules = [\n    'profile_photo' =\u003e [\n        'label' =\u003e 'Profile Photo',\n        'rules' =\u003e [\n            RuleEnum::IMAGE_MAX_WIDTH =\u003e [1000],\n        ],\n    ],\n];\n```\n\n| Value  |  image_max_width   | image_max_width + required |\n| ------ | :----------------: | :------------------------: |\n| `null` | :heavy_check_mark: |            :x:             |\n| 500px  | :heavy_check_mark: |     :heavy_check_mark:     |\n| 1500px |        :x:         |            :x:             |\n\n### image_min_height\n\nChecks whether the image height is not less than a given value.\n\n```php\n$rules = [\n    'profile_photo' =\u003e [\n        'label' =\u003e 'Profile Photo',\n        'rules' =\u003e [\n            RuleEnum::IMAGE_MIN_HEIGHT =\u003e [300],\n        ],\n    ],\n];\n```\n\n| Value  |  image_min_height  | image_min_height + required |\n| ------ | :----------------: | :-------------------------: |\n| `null` | :heavy_check_mark: |             :x:             |\n| 100px  |        :x:         |             :x:             |\n| 500px  | :heavy_check_mark: |     :heavy_check_mark:      |\n\n### image_min_width\n\nChecks whether the image width is not less than a given value.\n\n```php\n$rules = [\n    'profile_photo' =\u003e [\n        'label' =\u003e 'Profile Photo',\n        'rules' =\u003e [\n            RuleEnum::IMAGE_MIN_WIDTH =\u003e [500],\n        ],\n    ],\n];\n```\n\n| Value  |  image_min_width   | image_min_width + required |\n| ------ | :----------------: | :------------------------: |\n| `null` | :heavy_check_mark: |            :x:             |\n| 400px  |        :x:         |            :x:             |\n| 600px  | :heavy_check_mark: |     :heavy_check_mark:     |\n\n### integer\n\nChecks whether the value is integer.\n\n```php\n$rules = [\n    'distance' =\u003e [\n        'label' =\u003e 'Distance',\n        'rules' =\u003e [\n            RuleEnum::INTEGER,\n        ],\n    ],\n];\n```\n\n| Value    |      numeric       | numeric + required |\n| -------- | :----------------: | :----------------: |\n| `null`   | :heavy_check_mark: |        :x:         |\n| `''`     | :heavy_check_mark: |        :x:         |\n| `'0'`    |        :x:         |        :x:         |\n| `0`      | :heavy_check_mark: | :heavy_check_mark: |\n| `false`  |        :x:         |        :x:         |\n| `[]`     |        :x:         |        :x:         |\n| `-1`     | :heavy_check_mark: | :heavy_check_mark: |\n| `1`      | :heavy_check_mark: | :heavy_check_mark: |\n| `true`   |        :x:         |        :x:         |\n| `'text'` |        :x:         |        :x:         |\n\n### ip\n\nChecks whether the value is a valid IP address.\n\n```php\n$rules = [\n    'ip' =\u003e [\n        'label' =\u003e 'IP',\n        'rules' =\u003e [\n            RuleEnum::IP,\n        ],\n    ],\n];\n```\n\n| Value                    |         ip         |   ip + required    |\n| ------------------------ | :----------------: | :----------------: |\n| `null`                   | :heavy_check_mark: |        :x:         |\n| `''`                     | :heavy_check_mark: |        :x:         |\n| `'0'`                    |        :x:         |        :x:         |\n| `0`                      |        :x:         |        :x:         |\n| `false`                  |        :x:         |        :x:         |\n| `[]`                     |        :x:         |        :x:         |\n| `-1`                     |        :x:         |        :x:         |\n| `1`                      |        :x:         |        :x:         |\n| `true`                   |        :x:         |        :x:         |\n| `'text'`                 |        :x:         |        :x:         |\n| `'10.10.10.10'`          | :heavy_check_mark: | :heavy_check_mark: |\n| `'2607:f0d0:1002:51::4'` | :heavy_check_mark: | :heavy_check_mark: |\n\n### ipv4\n\nChecks whether the value is a valid IPv4 address.\n\n```php\n$rules = [\n    'ipv4' =\u003e [\n        'label' =\u003e 'IPv4',\n        'rules' =\u003e [\n            RuleEnum::IPV4,\n        ],\n    ],\n];\n```\n\n| Value                    |        ipv4        |  ipv4 + required   |\n| ------------------------ | :----------------: | :----------------: |\n| `null`                   | :heavy_check_mark: |        :x:         |\n| `''`                     | :heavy_check_mark: |        :x:         |\n| `'0'`                    |        :x:         |        :x:         |\n| `0`                      |        :x:         |        :x:         |\n| `false`                  |        :x:         |        :x:         |\n| `[]`                     |        :x:         |        :x:         |\n| `-1`                     |        :x:         |        :x:         |\n| `1`                      |        :x:         |        :x:         |\n| `true`                   |        :x:         |        :x:         |\n| `'text'`                 |        :x:         |        :x:         |\n| `'10.10.10.10'`          | :heavy_check_mark: | :heavy_check_mark: |\n| `'2607:f0d0:1002:51::4'` |        :x:         |        :x:         |\n\n### ipv6\n\nChecks whether the value is a valid IPv6 address.\n\n```php\n$rules = [\n    'ipv6' =\u003e [\n        'label' =\u003e 'IPv6',\n        'rules' =\u003e [\n            RuleEnum::IPV6,\n        ],\n    ],\n];\n```\n\n| Value                    |        ipv6        |  ipv6 + required   |\n| ------------------------ | :----------------: | :----------------: |\n| `null`                   | :heavy_check_mark: |        :x:         |\n| `''`                     | :heavy_check_mark: |        :x:         |\n| `'0'`                    |        :x:         |        :x:         |\n| `0`                      |        :x:         |        :x:         |\n| `false`                  |        :x:         |        :x:         |\n| `[]`                     |        :x:         |        :x:         |\n| `-1`                     |        :x:         |        :x:         |\n| `1`                      |        :x:         |        :x:         |\n| `true`                   |        :x:         |        :x:         |\n| `'text'`                 |        :x:         |        :x:         |\n| `'10.10.10.10'`          |        :x:         |        :x:         |\n| `'2607:f0d0:1002:51::4'` | :heavy_check_mark: | :heavy_check_mark: |\n\n### max\n\nChecks whether the value does not exceed a given value.\n\n```php\n$rules = [\n    'people' =\u003e [\n        'label' =\u003e 'People',\n        'rules' =\u003e [\n            RuleEnum::MAX =\u003e [5],\n        ],\n    ],\n];\n```\n\n| Value     |        max         |   max + required   |\n| --------- | :----------------: | :----------------: |\n| `null`    | :heavy_check_mark: |        :x:         |\n| `''`      | :heavy_check_mark: |        :x:         |\n| `'0'`     | :heavy_check_mark: | :heavy_check_mark: |\n| `0`       | :heavy_check_mark: | :heavy_check_mark: |\n| `false`   |        :x:         |        :x:         |\n| `[]`      |        :x:         |        :x:         |\n| `-1`      | :heavy_check_mark: | :heavy_check_mark: |\n| `1`       | :heavy_check_mark: | :heavy_check_mark: |\n| `true`    |        :x:         |        :x:         |\n| `'text'`  |        :x:         |        :x:         |\n| `12345`   |        :x:         |        :x:         |\n| `'12345'` |        :x:         |        :x:         |\n\n### max_length\n\nChecks whether the number of characters of the value does not exceed a given value.\n\n```php\n$rules = [\n    'nickname' =\u003e [\n        'label' =\u003e 'Nickname',\n        'rules' =\u003e [\n            RuleEnum::MAX_LENGTH =\u003e [2],\n        ],\n    ],\n];\n```\n\n| Value     |     max_length     | max_length + required |\n| --------- | :----------------: | :-------------------: |\n| `null`    | :heavy_check_mark: |          :x:          |\n| `''`      | :heavy_check_mark: |          :x:          |\n| `'0'`     | :heavy_check_mark: |  :heavy_check_mark:   |\n| `0`       | :heavy_check_mark: |  :heavy_check_mark:   |\n| `false`   | :heavy_check_mark: |  :heavy_check_mark:   |\n| `[]`      |        :x:         |          :x:          |\n| `-1`      | :heavy_check_mark: |  :heavy_check_mark:   |\n| `1`       | :heavy_check_mark: |  :heavy_check_mark:   |\n| `true`    | :heavy_check_mark: |  :heavy_check_mark:   |\n| `'text'`  |        :x:         |          :x:          |\n| `12345`   |        :x:         |          :x:          |\n| `'12345'` |        :x:         |          :x:          |\n\n### min\n\nChecks whether the value is not less than a given value.\n\n```php\n$rules = [\n    'people' =\u003e [\n        'label' =\u003e 'People',\n        'rules' =\u003e [\n            RuleEnum::MIN =\u003e [2],\n        ],\n    ],\n];\n```\n\n| Value     |        min         |   min + required   |\n| --------- | :----------------: | :----------------: |\n| `null`    | :heavy_check_mark: |        :x:         |\n| `''`      | :heavy_check_mark: |        :x:         |\n| `'0'`     |        :x:         |        :x:         |\n| `0`       |        :x:         |        :x:         |\n| `false`   |        :x:         |        :x:         |\n| `[]`      |        :x:         |        :x:         |\n| `-1`      |        :x:         |        :x:         |\n| `1`       |        :x:         |        :x:         |\n| `true`    |        :x:         |        :x:         |\n| `'text'`  |        :x:         |        :x:         |\n| `12345`   | :heavy_check_mark: | :heavy_check_mark: |\n| `'12345'` | :heavy_check_mark: | :heavy_check_mark: |\n\n### min_length\n\nChecks whether the number of characters of the value is not less than a given value.\n\n```php\n$rules = [\n    'nickname' =\u003e [\n        'label' =\u003e 'Nickname',\n        'rules' =\u003e [\n            RuleEnum::MIN_LENGTH =\u003e [2],\n        ],\n    ],\n];\n```\n\n| Value     |     max_length     | max_length + required |\n| --------- | :----------------: | :-------------------: |\n| `null`    | :heavy_check_mark: |          :x:          |\n| `''`      |        :x:         |          :x:          |\n| `'0'`     |        :x:         |          :x:          |\n| `0`       |        :x:         |          :x:          |\n| `false`   |        :x:         |          :x:          |\n| `[]`      |        :x:         |          :x:          |\n| `-1`      | :heavy_check_mark: |  :heavy_check_mark:   |\n| `1`       |        :x:         |          :x:          |\n| `true`    |        :x:         |          :x:          |\n| `'text'`  | :heavy_check_mark: |  :heavy_check_mark:   |\n| `12345`   | :heavy_check_mark: |  :heavy_check_mark:   |\n| `'12345'` | :heavy_check_mark: |  :heavy_check_mark:   |\n\n### numeric\n\nChecks whether the value is numeric.\n\n```php\n$rules = [\n    'age' =\u003e [\n        'label' =\u003e 'Age',\n        'rules' =\u003e [\n            RuleEnum::NUMERIC,\n        ],\n    ],\n];\n```\n\n| Value    |      numeric       | numeric + required |\n| -------- | :----------------: | :----------------: |\n| `null`   | :heavy_check_mark: |        :x:         |\n| `''`     | :heavy_check_mark: |        :x:         |\n| `'0'`    | :heavy_check_mark: | :heavy_check_mark: |\n| `0`      | :heavy_check_mark: | :heavy_check_mark: |\n| `false`  |        :x:         |        :x:         |\n| `[]`     |        :x:         |        :x:         |\n| `-1`     | :heavy_check_mark: | :heavy_check_mark: |\n| `1`      | :heavy_check_mark: | :heavy_check_mark: |\n| `true`   |        :x:         |        :x:         |\n| `'text'` |        :x:         |        :x:         |\n\n### regex\n\nChecks whether the value matches a given regular expression.\n\n```php\n$rules = [\n    'path' =\u003e [\n        'label' =\u003e 'Path',\n        'rules' =\u003e [\n            RuleEnum::REGEX =\u003e ['/\\/client\\/[0-9a-f]+$/'],\n        ],\n    ],\n];\n```\n\nValidation with the `'/\\/client\\/[0-9a-f]+$/'` pattern\n\n| Value                                        |       regex        |  regex + required  |\n| -------------------------------------------- | :----------------: | :----------------: |\n| `null`                                       | :heavy_check_mark: |        :x:         |\n| `''`                                         | :heavy_check_mark: |        :x:         |\n| `'0'`                                        |        :x:         |        :x:         |\n| `0`                                          |        :x:         |        :x:         |\n| `false`                                      |        :x:         |        :x:         |\n| `[]`                                         |        :x:         |        :x:         |\n| `-1`                                         |        :x:         |        :x:         |\n| `1`                                          |        :x:         |        :x:         |\n| `true`                                       |        :x:         |        :x:         |\n| `'text'`                                     |        :x:         |        :x:         |\n| `'/client/77c9e105d1f548b29958f0512967de87'` | :heavy_check_mark: | :heavy_check_mark: |\n| `'/client/invalid-uuid'`                     |        :x:         |        :x:         |\n\n### required\n\nChecks whether the value is not empty.\n\n```php\n$rules = [\n    'name' =\u003e [\n        'label' =\u003e 'Name',\n        'rules' =\u003e [\n            RuleEnum::REQUIRED,\n        ],\n    ],\n];\n```\n\n| Value         |      required      |\n| ------------- | :----------------: |\n| `null`        |        :x:         |\n| `''`          |        :x:         |\n| `'0'`         | :heavy_check_mark: |\n| `0`           | :heavy_check_mark: |\n| `false`       | :heavy_check_mark: |\n| `[]`          |        :x:         |\n| `-1`          | :heavy_check_mark: |\n| `1`           | :heavy_check_mark: |\n| `true`        | :heavy_check_mark: |\n| `'some text'` | :heavy_check_mark: |\n\n### slug\n\nChecks whether the value is a valid Slug (e.g. hello-world_123).\n\n```php\n$rules = [\n    'slug' =\u003e [\n        'label' =\u003e 'Slug',\n        'rules' =\u003e [\n            RuleEnum::SLUG,\n        ],\n    ],\n];\n```\n\n| Value                |        slug        |  slug + required   |\n| -------------------- | :----------------: | :----------------: |\n| `null`               | :heavy_check_mark: |        :x:         |\n| `''`                 | :heavy_check_mark: |        :x:         |\n| `'0'`                |        :x:         |        :x:         |\n| `0`                  |        :x:         |        :x:         |\n| `false`              |        :x:         |        :x:         |\n| `[]`                 |        :x:         |        :x:         |\n| `-1`                 |        :x:         |        :x:         |\n| `1`                  |        :x:         |        :x:         |\n| `true`               |        :x:         |        :x:         |\n| `'text'`             | :heavy_check_mark: | :heavy_check_mark: |\n| `'text with spaces'` |        :x:         |        :x:         |\n| `'hello-world_123'`  | :heavy_check_mark: | :heavy_check_mark: |\n\n### url\n\nChecks whether the value is a valid URL.\n\n```php\n$rules = [\n    'url' =\u003e [\n        'label' =\u003e 'URL',\n        'rules' =\u003e [\n            RuleEnum::URL,\n        ],\n    ],\n];\n```\n\n| Value                          |        url         |   url + required   |\n| ------------------------------ | :----------------: | :----------------: |\n| `null`                         | :heavy_check_mark: |        :x:         |\n| `''`                           | :heavy_check_mark: |        :x:         |\n| `'0'`                          |        :x:         |        :x:         |\n| `0`                            |        :x:         |        :x:         |\n| `false`                        |        :x:         |        :x:         |\n| `[]`                           |        :x:         |        :x:         |\n| `-1`                           |        :x:         |        :x:         |\n| `1`                            |        :x:         |        :x:         |\n| `true`                         |        :x:         |        :x:         |\n| `'text'`                       |        :x:         |        :x:         |\n| `'http://www.some-domain.com'` | :heavy_check_mark: | :heavy_check_mark: |\n\n## Contributing\n\nWant to contribute? All contributions are welcome. Read the\n[contributing guide](CONTRIBUTING.md).\n\n## Questions\n\nIf you have questions tweet me at [@sandro_m_m](https://twitter.com/sandro_m_m)\nor [open an issue](../../issues/new).\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file\nfor details\n\n**~ sharing is caring ~**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandromiguel%2Fverum-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsandromiguel%2Fverum-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandromiguel%2Fverum-php/lists"}