{"id":36978792,"url":"https://github.com/wudege/tforms","last_synced_at":"2026-01-13T22:48:18.780Z","repository":{"id":57082722,"uuid":"81796184","full_name":"wudege/tforms","owner":"wudege","description":"TForms is a flexible forms validation library for PHP API project.","archived":false,"fork":false,"pushed_at":"2017-02-20T04:01:49.000Z","size":36,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-13T11:36:37.540Z","etag":null,"topics":["form-validation","forms","tforms","validation","validations","validator"],"latest_commit_sha":null,"homepage":null,"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/wudege.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}},"created_at":"2017-02-13T07:17:18.000Z","updated_at":"2017-03-23T09:49:36.000Z","dependencies_parsed_at":"2022-08-24T14:58:22.443Z","dependency_job_id":null,"html_url":"https://github.com/wudege/tforms","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/wudege/tforms","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wudege%2Ftforms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wudege%2Ftforms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wudege%2Ftforms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wudege%2Ftforms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wudege","download_url":"https://codeload.github.com/wudege/tforms/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wudege%2Ftforms/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28403742,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["form-validation","forms","tforms","validation","validations","validator"],"created_at":"2026-01-13T22:48:18.702Z","updated_at":"2026-01-13T22:48:18.771Z","avatar_url":"https://github.com/wudege.png","language":"PHP","readme":"# tforms\nTForms is a flexible forms validation library for PHP API project.\n\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE)\n[![Latest Stable Version](https://img.shields.io/packagist/v/wudege/tforms.svg)](https://packagist.org/packages/wudege/tforms)\n[![Total Downloads](https://img.shields.io/packagist/dt/wudege/tforms.svg)](https://packagist.org/packages/wudege/tforms)\n[![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social\u0026style=flat-square)](https://twitter.com/wudege)\n\n## INSTALL\n\n* Use the composer command or the composer.json file. That's the recommend way. And the SDK is here [`wudege/tforms`][install-packagist]\n```bash\n$ composer require wudege/tforms\n```\n\n## USAGE\n\n```php\n\nrequire __DIR__ . '/../vendor/autoload.php';\n\nclass UserEditForm extends \\TForms\\Form\n{\n    const GENDER_MALE   = 1;\n    const GENDER_FEMALE = 0;\n\n    public $username;\n    public $email;\n    public $age;\n    public $gender;\n    public $blog;\n\n    /**\n     *\n     * @author wudege \u003chi@wudege.me\u003e\n     * @return array\n     */\n    public function attributeNames()\n    {\n        return [\n            'username',\n            'email',\n            'age',\n            'gender',\n            'blog',\n        ];\n    }\n\n    public function attributeLabels()\n    {\n        return [\n            'username',\n            'email',\n            'age',\n            'gender',\n            'blog',\n        ];\n    }\n\n    public function rules()\n    {\n        return [\n            ['username, email, age, gender, blog', 'required'],\n            ['username', 'length', 'min' =\u003e 4, 'max' =\u003e 32],\n            ['email', 'email'],\n            ['age', 'numerical', 'min' =\u003e 18, 'max' =\u003e 28, 'integerOnly' =\u003e true],\n            ['gender', 'in', 'range' =\u003e [self::GENDER_MALE, self::GENDER_FEMALE]],\n            ['blog', 'url'],\n        ];\n    }\n}\n\n$form             = new UserEditForm();\n$form-\u003eattributes = [\n    'username' =\u003e 'wudege',\n    'email'    =\u003e 'hi@wudege.me',\n    'age'      =\u003e 20,\n    'gender'   =\u003e 1,\n    'blog'     =\u003e 'https://wudege.me',\n];\n\ntry {\n    $form-\u003evalidate();\n} catch (\\TForms\\Exception\\ValidationException $e) {\n    die($e-\u003egetMessage());\n}\ndie('done');\n\n```\n\n## TEST\n\n``` bash\n$ ./vendor/bin/phpunit tests/TForms/Tests \n```\n\n## LICENSE\n\nThe MIT License (MIT). [License File](https://github.com/wudege/tforms/blob/master/LICENSE).\n\n[packagist]: http://packagist.org\n[install-packagist]: https://packagist.org/packages/wudege/tforms\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwudege%2Ftforms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwudege%2Ftforms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwudege%2Ftforms/lists"}