{"id":27918627,"url":"https://github.com/hannasdev/validator","last_synced_at":"2025-07-06T15:41:09.177Z","repository":{"id":84016653,"uuid":"49869122","full_name":"hannasdev/Validator","owner":"hannasdev","description":"A PHP validator class","archived":false,"fork":false,"pushed_at":"2016-03-07T14:32:15.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-03-27T20:21:52.106Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hannasdev.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}},"created_at":"2016-01-18T10:20:38.000Z","updated_at":"2016-01-29T11:47:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"de4974a4-0e71-4a09-8b20-f7e95c8c3e55","html_url":"https://github.com/hannasdev/Validator","commit_stats":null,"previous_names":["hannasdev/validator"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hannasdev%2FValidator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hannasdev%2FValidator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hannasdev%2FValidator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hannasdev%2FValidator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hannasdev","download_url":"https://codeload.github.com/hannasdev/Validator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252742206,"owners_count":21797181,"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","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":[],"created_at":"2025-05-06T18:24:05.879Z","updated_at":"2025-05-06T18:24:06.501Z","avatar_url":"https://github.com/hannasdev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Validator\nA (static) PHP validator class. Lets you validate data according to different sets of rules, listed below.\n\n## Rules\n\n### minLength\n*minLength($string, $max)*\nChecks if a string has a minimum of x characters.\n```php\n\u003c?php\n$name = \"Hanna\";\nif (Validator::isMinLength($name, 3)) echo \"Valid\";\n?\u003e\n```\n\n### maxLength\n*maxLength($string, $max)*\n\nChecks if a string has a maximum of x characters.\n```php\n\u003c?php\n$name = \"Hanna\";\nif (!Validator::isMaxLength($name, 3)) echo \"Name is too long (maximum 3 characters), use a shorter name\";\n?\u003e\n```\n\n### matches\n*matches($string, $matches)*\n\nChecks if a string matches another.\n```php\n\u003c?php\n$name    = \"Hanna\";\n$matches = \"Hanna\";\nif (Validator::matches($name, $matches)) {\n    echo \"Name matches\";    \n} else {\n    echo \"Name is not valid\";\n}\n?\u003e\n```\n\n### hasNoSpecialChars\n*hasNoSpecialChars($string)*\n\nChecks that a string has no special characters: [\\'^£$%\u0026*}{@#~\u003e\u003c\u003e|=_+¬]\n```php\n\u003c?php\n$string = \"\u003cscript\u003ewindow.alert(\"Hello\");\u003c/script\u003e\";\nif (Validator::hasNoSpecialChars($string)) {\n    echo \"Contains invalid characters!\";    \n}\n?\u003e\n```\n\n### timeStamp\n*timeStamp($string)*\n\nChecks that a string is a valid timestamp.\n```php\n\u003c?php\n$timestamp = \"2016-02-15\";\nif (Validator::isTimeStamp($timestamp)) {\n    echo \"This is a valid timestamp.\";    \n}\n?\u003e\n```\n\n### yearMonth\n*yearMonth($string)*\n\nChecks that a string is made of year and month.\n```php\n\u003c?php\n$yearMonth = \"2016-02\";\nif (Validator::isYearMonth($yearMonth)) {\n    echo \"This is a valid.\";    \n}\n?\u003e\n```\n\n### alphabetic\n*alphabetic($string)*\n\nChecks that a string is alphabetic.\n```php\n\u003c?php\n$string = \"2016-02\";\nif (!Validator::isAlphabetic($string)) {\n    echo \"Must contain _letters_ only.\"\n}\n?\u003e\n```\n\n### alphaNumeric\n*alphaNumeric($string)*\n\nChecks that a string is alphanumeric.\n```php\n\u003c?php\n$string = \"Month12\";\nif (Validator::isAlphaNumeric($string)) {\n    echo \"This is a valid string.\";\n}\n?\u003e\n```\n\n### digit\n*digit($string)*\n\nChecks that a string has only digits.\n```php\n\u003c?php\n$string = \"12345\";\nif (Validator::isDigit($string)) {\n    echo \"This is a valid string.\";\n}\n?\u003e\n```\n\n### email\n*email($string)*\n\nChecks that a string is an email.\n```php\n\u003c?php\n$string = \"info@hannasoderstrom.com\";\nif (Validator::isEmail($string)) {\n    echo \"This is a valid email.\";\n}\n?\u003e\n```\n\n### url\n*URL($string)*\n\nChecks that a string is an URL.\n```php\n\u003c?php\n$string = \"http://www.hannasoderstrom.com\";\nif (Validator::isUrl($string)) {\n    echo \"This is a valid URL.\";\n}\n?\u003e\n```\n\n### name\n*name($string)*\n\nChecks that a string is a name (only space and letters)\n```php\n\u003c?php\n$string = \"Hanna Söderström\";\nif (Validator::isName($string)) {\n    echo \"This is a valid name.\";\n}\n?\u003e\n```\n\n\n## Escaping\n\n### html\n*html($string)*\n\nEscapes a string so that it can safely be used in HTML.\n```php\n\u003cp\u003eName: \u003c?php Validator::html($name); ?\u003e\u003c/p\u003e\n```\n\n## Author\n* Hanna Söderström\n* info@hannasoderstrom.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhannasdev%2Fvalidator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhannasdev%2Fvalidator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhannasdev%2Fvalidator/lists"}