{"id":13343449,"url":"https://github.com/thyseus/yii2-word-validator","last_synced_at":"2026-04-29T17:06:12.543Z","repository":{"id":57069334,"uuid":"65122468","full_name":"thyseus/yii2-word-validator","owner":"thyseus","description":null,"archived":false,"fork":false,"pushed_at":"2018-06-06T08:24:15.000Z","size":8,"stargazers_count":1,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-08T19:35:35.859Z","etag":null,"topics":["blacklist","validator","whitelist","yii","yii2-extension"],"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/thyseus.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","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":"2016-08-07T08:00:37.000Z","updated_at":"2018-06-06T08:24:16.000Z","dependencies_parsed_at":"2022-08-24T14:54:16.555Z","dependency_job_id":null,"html_url":"https://github.com/thyseus/yii2-word-validator","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/thyseus/yii2-word-validator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thyseus%2Fyii2-word-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thyseus%2Fyii2-word-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thyseus%2Fyii2-word-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thyseus%2Fyii2-word-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thyseus","download_url":"https://codeload.github.com/thyseus/yii2-word-validator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thyseus%2Fyii2-word-validator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32435140,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T13:34:34.882Z","status":"ssl_error","status_checked_at":"2026-04-29T13:34:29.830Z","response_time":110,"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":["blacklist","validator","whitelist","yii","yii2-extension"],"created_at":"2024-07-29T19:31:22.048Z","updated_at":"2026-04-29T17:06:12.527Z","avatar_url":"https://github.com/thyseus.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ATTENTION:\n\ngithub has been bought by Microsoft. This repository is orphaned and has been moved to:\n\nhttps://gitlab.com/thyseus/yii2-word-validator\n\nThanks a lot for your understanding and blame Microsoft.\n\nWord Validator\n==============\n\nWordValidator validates that the attribute value has a specific words count and checks this value against whitelist and blacklist.\nIt is a port of https://github.com/antonCPU/word-validator from Anton Yakushin from Yii 1 to Yii 2.\n\n##Requirements\n\nTested in Yii 2.0.9.\n\n##Installation\n\ncomposer require thyseus/yii2-word-validator\n\n##Usage\n\nAdd the following code to your model class rules() method\n\n~~~\nuse thyseus\\validators\\WordValidator;\n\npublic function rules()\n{\n   return [\n       //other validators...\n       array('attributeName', WordValidator::className(), /*add custom rules here*/),\n   );\n}\n\n~~~\n\nFor example:\n\n~~~\nuse thyseus\\validators\\WordValidator;\n\npublic function rules() {\n  return [\n    [['message'], WordValidator::className(),\n    'min' =\u003e 2,\n    'max' =\u003e 5,\n    'whitelist' =\u003e array('please', 'test'),\n    'blacklist' =\u003e array('restricted', 'email.*'), //could be a regular expression\n    'messages'  =\u003e array(\n        'max' =\u003e '{attribute} is too long (maximum is {max} words, but now it\\'s {length})'\n        ),\n    ];\n  ];\n~~~\n\n#### Validation rules\n- **max** - the attribute should contain less (or equal) words count;\n- **min** - minimum words count;\n- **exact** - expected only this words count;\n- **blacklist** - array of words that should not be in the attribute.\n                There also could be a regular expression;\n- **whitelist** - at least one of these words/expressions must be in the attribute.\n\n#### Messages\nAny default error message could be overridden using **messages** parameter.\nAll messages support {attribute} and {length} placeholders. Each validation\nmethod adds it's value to a correspond (the same as a name) placeholder.\nFor **min** rule a message could be specified as:\n~~~\n[/*...*/\n    'messages' =\u003e array(\n        'min' =\u003e 'Your {attribute} is now has {length} words. But should be\n             at least {min}'\n    ),\n],\n~~~\n\nClient side validation is supported.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthyseus%2Fyii2-word-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthyseus%2Fyii2-word-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthyseus%2Fyii2-word-validator/lists"}