{"id":29017868,"url":"https://github.com/cakephp/form","last_synced_at":"2025-09-15T00:21:38.933Z","repository":{"id":62499052,"uuid":"77005132","full_name":"cakephp/form","owner":"cakephp","description":"[READ-ONLY] - Form abstraction used to create forms not tied to ORM backed models, or to other permanent datastores.","archived":false,"fork":false,"pushed_at":"2025-08-31T02:28:12.000Z","size":144,"stargazers_count":8,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-31T04:17:36.972Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cakephp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2016-12-21T01:32:26.000Z","updated_at":"2024-12-16T06:53:30.000Z","dependencies_parsed_at":"2024-01-28T04:29:46.270Z","dependency_job_id":"719ade30-dffb-4afd-a3f9-801287c1ea54","html_url":"https://github.com/cakephp/form","commit_stats":{"total_commits":120,"total_committers":20,"mean_commits":6.0,"dds":0.5833333333333333,"last_synced_commit":"41da298aba74fc4f608b62f4af9248bab0c9222e"},"previous_names":[],"tags_count":243,"template":false,"template_full_name":null,"purl":"pkg:github/cakephp/form","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cakephp%2Fform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cakephp%2Fform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cakephp%2Fform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cakephp%2Fform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cakephp","download_url":"https://codeload.github.com/cakephp/form/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cakephp%2Fform/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275186488,"owners_count":25420136,"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","status":"online","status_checked_at":"2025-09-14T02:00:10.474Z","response_time":75,"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":"2025-06-25T23:07:17.413Z","updated_at":"2025-09-15T00:21:38.872Z","avatar_url":"https://github.com/cakephp.png","language":"PHP","readme":"[![Total Downloads](https://img.shields.io/packagist/dt/cakephp/form.svg?style=flat-square)](https://packagist.org/packages/cakephp/form)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](LICENSE.txt)\n\n# CakePHP Form Library\n\nForm abstraction used to create forms not tied to ORM backed models,\nor to other permanent datastores. Ideal for implementing forms on top of\nAPI services, or contact forms.\n\n## Usage\n\n\n```php\nuse Cake\\Form\\Form;\nuse Cake\\Form\\Schema;\nuse Cake\\Validation\\Validator;\n\nclass ContactForm extends Form\n{\n\n    protected function _buildSchema(Schema $schema)\n    {\n        return $schema-\u003eaddField('name', 'string')\n            -\u003eaddField('email', ['type' =\u003e 'string'])\n            -\u003eaddField('body', ['type' =\u003e 'text']);\n    }\n\n    public function validationDefault(Validator $validator)\n    {\n        return $validator-\u003eadd('name', 'length', [\n                'rule' =\u003e ['minLength', 10],\n                'message' =\u003e 'A name is required'\n            ])-\u003eadd('email', 'format', [\n                'rule' =\u003e 'email',\n                'message' =\u003e 'A valid email address is required',\n            ]);\n    }\n\n    protected function _execute(array $data)\n    {\n        // Send an email.\n        return true;\n    }\n}\n```\n\nIn the above example we see the 3 hook methods that forms provide:\n\n- `_buildSchema()` is used to define the schema data. You can define field type, length, and precision.\n- `validationDefault()` Gets a `Cake\\Validation\\Validator` instance that you can attach validators to.\n- `_execute()` lets you define the behavior you want to happen when `execute()` is called and the data is valid.\n\nYou can always define additional public methods as you need as well.\n\n```php\n$contact = new ContactForm();\n$success = $contact-\u003eexecute($data);\n$errors = $contact-\u003egetErrors();\n```\n\n## Documentation\n\nPlease make sure you check the [official documentation](https://book.cakephp.org/4/en/core-libraries/form.html)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcakephp%2Fform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcakephp%2Fform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcakephp%2Fform/lists"}