{"id":21897245,"url":"https://github.com/h2lsoft/validator","last_synced_at":"2026-02-04T00:04:19.054Z","repository":{"id":62513795,"uuid":"259602157","full_name":"h2lsoft/validator","owner":"h2lsoft","description":"A library of validators values in multilanguage with CSRF protection","archived":false,"fork":false,"pushed_at":"2024-07-04T15:52:41.000Z","size":87,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-04T09:47:06.002Z","etag":null,"topics":["csrf","csrf-protection","data","form","php","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/h2lsoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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,"zenodo":null}},"created_at":"2020-04-28T10:16:34.000Z","updated_at":"2024-07-04T15:52:46.000Z","dependencies_parsed_at":"2025-07-05T13:15:33.576Z","dependency_job_id":null,"html_url":"https://github.com/h2lsoft/validator","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/h2lsoft/validator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h2lsoft%2Fvalidator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h2lsoft%2Fvalidator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h2lsoft%2Fvalidator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h2lsoft%2Fvalidator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/h2lsoft","download_url":"https://codeload.github.com/h2lsoft/validator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h2lsoft%2Fvalidator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29062485,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T23:14:54.203Z","status":"ssl_error","status_checked_at":"2026-02-03T23:14:50.873Z","response_time":96,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["csrf","csrf-protection","data","form","php","validator"],"created_at":"2024-11-28T14:16:41.776Z","updated_at":"2026-02-04T00:04:19.033Z","avatar_url":"https://github.com/h2lsoft.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Validator\nA library for string validators values in multilanguage.\n\n[![Version](https://badge.fury.io/gh/h2lsoft%2Fvalidator.svg)](https://badge.fury.io/gh/h2lsoft%2Fvalidator)\n\n## Installation\n\nInstall directly via [Composer](https://getcomposer.org):\n```bash\n$ composer require h2lsoft/validator\n```\n\n## Basic Usage\n\n\n```php\n// simulate POST\n$_POST['name'] = 'the king !';\n$_POST['email'] = 'fa@email';\n$_POST['zip_code'] = 'a2345';\n$_POST['choices'] = ['apple'];\n$_POST['job'] = 'webdesigner';\n$_POST['days'] = '-50';\n$_POST['date'] = '31/20/2020';\n$_POST['datetime'] = '31/20/2020 12:00';\n$_POST['website'] = 'text.com';\n$_POST['regex_test'] = 'abcdef';\n$_POST['conditions'] = 0;\n\n// rules\n$validator = new \\h2lsoft\\Data\\Validator('en'); // `en` by default but you can change it\n$validator-\u003einput('name')-\u003erequired()-\u003ealpha(' '); // space allowed\n$validator-\u003einput('email', \"email address\")-\u003erequired()-\u003eemail();\n$validator-\u003einput('zip_code', 'zip code')-\u003erequired()-\u003emask('99999');\n$validator-\u003einput('choices')-\u003erequired()-\u003emultiple()-\u003ein(['banana', 'pear'])-\u003eminLength(2);\n$validator-\u003einput('job')-\u003erequired()-\u003eequal('CEO');\n$validator-\u003einput('days')-\u003erequired()-\u003einteger()-\u003ebetween(1, 60);\n$validator-\u003einput('date')-\u003edate('m/d/Y');\n$validator-\u003einput('datetime')-\u003erequired()-\u003edatetime('m/d/Y H:i');\n$validator-\u003einput('website')-\u003eurl(FILTER_FLAG_PATH_REQUIRED);\n$validator-\u003einput('regex_test')-\u003eregex(\"/^x/i\", \"`[FIELD]` must start by x\");\n$validator-\u003einput('conditions')-\u003erequired()-\u003eaccepted();\n\nif($validator-\u003efails())\n{\n\tprint_r($validator-\u003eresult());\n}\nelse\n{\n\tdie(\"No error detected\");\n}\n```\n\n## Rules\n\n### Strings\n* required\n* email\n* mask\n* in\n* notIn\n* integer\n* float\n* min\n* max\n* between\n* length\n* minLength\n* maxLength\n* equal\n* accepted\n* url\n* alpha\n* alphaNumeric\n* date\n* datetime\n* regex\n* ip\n* sameAs\n* requiredIf\n\n\n### Array (checkboxes, select multiple)\n\n* multiple\n* between\n* min\n* max\n\n\n### Files\n\n* fileRequired\n* fileMaxSize\n* fileExtension\n* fileMime\n* fileImage\n* fileImageBase64\n* fileImageWidth\n* fileImageHeight\n\n\n## Customisation\n\n* addLocalMessages\n* setInputNames (array)\n* setInputName\n* addError (custom error)\n\n\n\n**More information see examples directory**\n\n\n## License\n\nMIT. See full [license](LICENSE).\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fh2lsoft%2Fvalidator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fh2lsoft%2Fvalidator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fh2lsoft%2Fvalidator/lists"}