{"id":26502885,"url":"https://github.com/grassator/duckform","last_synced_at":"2025-03-20T18:36:13.218Z","repository":{"id":12279580,"uuid":"14903448","full_name":"grassator/duckform","owner":"grassator","description":"Use regular HTML5 markup for dealing with forms in PHP","archived":false,"fork":false,"pushed_at":"2014-01-14T16:06:40.000Z","size":160,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-04-09T14:49:33.727Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grassator.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-03T19:26:54.000Z","updated_at":"2014-01-14T16:06:40.000Z","dependencies_parsed_at":"2022-08-20T20:51:00.483Z","dependency_job_id":null,"html_url":"https://github.com/grassator/duckform","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grassator%2Fduckform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grassator%2Fduckform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grassator%2Fduckform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grassator%2Fduckform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grassator","download_url":"https://codeload.github.com/grassator/duckform/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244672297,"owners_count":20491345,"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-03-20T18:36:12.513Z","updated_at":"2025-03-20T18:36:13.203Z","avatar_url":"https://github.com/grassator.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Duck Form\n\nProvides a way to use regular HTML5 form markup to populate forms with values and validate them on server side with PHP. It's also quite fast.\n\n## Why \"Duck\"?\n\nDucks are cool!\n\n## Usage\n\nSimple usage looks like this:\n\n```php\nrequire 'DuckForm.php';\n\n$form =  DuckForm::fromFile(\"file_with_form_markup.html\");\n\n// Custom validator\n$this-\u003eform-\u003eaddFieldValidator('country', function($value, $fields, $form){\n    if(count($value) \u003e 2) {\n        return \"There should be more than 2 countries selected.\";\n    }\n    return false;\n})\n\nif($_SERVER['REQUEST_METHOD'] === 'POST') {\n    $form-\u003ebind($_REQUEST);\n    if($form-\u003evalidate()) {\n        // Form processing should go here\n        \n        // redirecting user to a thank you page\n        header('Location: /thankyou.html');\n        exit;\n    }\n}\necho $form;\n```\n\nIt will render errors if necessary and will re-fill submitted form data. \n\n## Requirements\n\nPHP 5 with [DOM extension](http://www.php.net/manual/en/book.dom.php), which is bundled by default.\n\n## Configuration\n\nYou can customize html classes for generated errors.\n\n```php\n$form-\u003eerrorClass = 'my-error-class';\n$form-\u003eerrorListClass = 'my-error-list-class';\n```\n\n## Known Issues / Missing Features\n\n* No file upload support\n* Lack of validators except for required and email\n\n## Licensing\n\nLicensed under permissive [MIT-style license](https://github.com/grassator/duckform/blob/master/LICENSE-MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrassator%2Fduckform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrassator%2Fduckform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrassator%2Fduckform/lists"}