{"id":42232947,"url":"https://github.com/php-lsys/validation","last_synced_at":"2026-01-27T03:11:59.162Z","repository":{"id":62519627,"uuid":"148025761","full_name":"php-lsys/validation","owner":"php-lsys","description":"lsys module:validation   install: composer require lsys/validation","archived":false,"fork":false,"pushed_at":"2020-07-03T15:34:50.000Z","size":65,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-27T17:18:46.499Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/php-lsys.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-09T13:00:58.000Z","updated_at":"2020-07-03T15:32:46.000Z","dependencies_parsed_at":"2022-11-02T13:31:46.929Z","dependency_job_id":null,"html_url":"https://github.com/php-lsys/validation","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/php-lsys/validation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-lsys%2Fvalidation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-lsys%2Fvalidation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-lsys%2Fvalidation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-lsys%2Fvalidation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php-lsys","download_url":"https://codeload.github.com/php-lsys/validation/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-lsys%2Fvalidation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28798679,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T01:07:07.743Z","status":"online","status_checked_at":"2026-01-27T02:00:07.755Z","response_time":168,"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":[],"created_at":"2026-01-27T03:11:58.622Z","updated_at":"2026-01-27T03:11:59.157Z","avatar_url":"https://github.com/php-lsys.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 数组校验\r\n\u003e 实现对数据的有效性的校验,常用的$_POST 和$_GET的有效性的检测\r\n\r\n示例代码:\r\n```php\r\nuse LSYS\\Validation;\r\ninclude __DIR__.\"/Bootstarp.php\";\r\n//$data=$_POST;\r\n$data=array(\r\n\t\"username\"=\u003e\"ddddd\",\r\n);\r\n$validation = Validation::factory($data); \r\n//给字段添加别名,显示用\r\n$validation-\u003elabel(\"username\",__(\"username\"));\r\n//添加判断规则\r\n$validation-\u003erule('username', 'not_empty')\r\n\t-\u003erule('username', 'min_length', array(':value', 4))\r\n\t-\u003erule(\"username\",function($valid,$value){\r\n\t//自定义校验函数\r\n\t//添加错误消息,校验未通过时赋值\r\n\t$valid-\u003eerror(\"username\", \"bbbb\");\r\n\t$valid-\u003emessage(\"username.bbbb\",__(\"bad msg\"));\r\n\t},array(':validation',':value')/*第三个参数为参数定义*/);\r\n//进行校验\r\nif (!$validation-\u003echeck()){\r\n\t//校验未通过\r\n\tprint_r($validation-\u003eerrors(TRUE));\r\n}\r\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-lsys%2Fvalidation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp-lsys%2Fvalidation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-lsys%2Fvalidation/lists"}