{"id":17976041,"url":"https://github.com/stefangabos/zebra_form","last_synced_at":"2025-10-28T07:03:46.451Z","repository":{"id":10230618,"uuid":"12331710","full_name":"stefangabos/Zebra_Form","owner":"stefangabos","description":"A jQuery augmented PHP library for creating secure HTML forms and validating them easily","archived":false,"fork":false,"pushed_at":"2022-07-11T18:09:53.000Z","size":766,"stargazers_count":97,"open_issues_count":20,"forks_count":49,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-04-02T08:09:33.356Z","etag":null,"topics":["csrf-protection","form-validation","html-form","php","php-form","xss"],"latest_commit_sha":null,"homepage":"","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/stefangabos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-08-23T20:14:29.000Z","updated_at":"2025-01-29T19:32:28.000Z","dependencies_parsed_at":"2022-08-19T17:31:34.861Z","dependency_job_id":null,"html_url":"https://github.com/stefangabos/Zebra_Form","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefangabos%2FZebra_Form","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefangabos%2FZebra_Form/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefangabos%2FZebra_Form/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefangabos%2FZebra_Form/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stefangabos","download_url":"https://codeload.github.com/stefangabos/Zebra_Form/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248018060,"owners_count":21034048,"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":["csrf-protection","form-validation","html-form","php","php-form","xss"],"created_at":"2024-10-29T17:21:43.813Z","updated_at":"2025-10-07T22:05:53.977Z","avatar_url":"https://github.com/stefangabos.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Zebra_Form\n\n#### A jQuery augmented PHP library for creating and validating HTML forms\n\n----\n[Packagist](https://packagist.org/) stats\n\n[![Latest Stable Version](https://poser.pugx.org/stefangabos/zebra_form/v/stable)](https://packagist.org/packages/stefangabos/zebra_form) [![Total Downloads](https://poser.pugx.org/stefangabos/zebra_form/downloads)](https://packagist.org/packages/stefangabos/zebra_form) [![Monthly Downloads](https://poser.pugx.org/stefangabos/zebra_form/d/monthly)](https://packagist.org/packages/stefangabos/zebra_form) [![Daily Downloads](https://poser.pugx.org/stefangabos/zebra_form/d/daily)](https://packagist.org/packages/stefangabos/zebra_form) [![License](https://poser.pugx.org/stefangabos/zebra_form/license)](https://packagist.org/packages/stefangabos/zebra_form)\n\nZebra_Form is a PHP library that greatly simplifies the process of creating and validating HTML forms. Its object-oriented structure promotes rapid HTML forms development and encourages developers to write clean and easily maintainable code and it frees the developers from the repetitive task of writing the code for validating forms by offering powerful built-in client-side and server-side validation.\n\nZebra_Form has integrated [cross-site scripting](http://en.wikipedia.org/wiki/Cross-site_scripting) (XSS) prevention mechanism that automatically strips out potentially malicious code from the submitted data, and also features protection against [cross-site request forgery](http://en.wikipedia.org/wiki/Cross-site_request_forgery) (CSRF) attacks. It also prevents automated SPAM posts, out of the box and without relying on CAPTCHA by using [honeypots](http://haacked.com/archive/2007/09/11/honeypot-captcha.aspx).\n\nForms layout can be generated either automatically or manually – using templates. When generated automatically, the generated output validates as HTML 4.01 Strict, XHTML 1.0 Strict or HTML5, and has the same look \u0026 feel across all major browsers like Firefox, Chrome, Opera, Safari and Internet Explorer 6+.\n\nIt provides all the controls you’d expect in an HTML form and, additionally, date/time pickers, CAPTCHA and advanced AJAX-like file upload controls – see the [documentation](http://stefangabos.ro/wp-content/docs/Zebra_Form/Generic/Zebra_Form_Control.html#methodset_rule) for validation rules that can be used out of the box.\n\nThe client-side validation is done using jQuery 1.5.2+\n\nZebra\\_Form's code is heavily commented and generates no warnings/errors/notices when PHP’s error reporting level is set to E_ALL.\n\n## Features\n\n- provides protection against cross-site scripting (XSS) and cross-site request forgery (CSRF) attacks out of the box\nit automatically prevents automated SPAM posts using the “honeypot” technique (CAPTCHAs can also be used for even stronger protection)\n- provides both server-side and client-side validation (client-side validation is done using jQuery 1.5.2+) and has a lot of predefined rules that can be used out of the box; custom validation rules (including AJAX-based) can easily be added\n- forms’ layout can be generated either automatically or manually using templates\n- generated output validates as HTML 4.01 Strict, XHTML 1.0 Strict or HTML5\n- works in all major browsers like Firefox, Chrome, Opera, Safari and Internet Explorer 6+\n- code is heavily commented and generates no warnings/errors/notices when PHP’s error reporting level is set to E_ALL\n- has comprehensive documentation\n\n## Requirements\n\nPHP 5.0.2+ (preferably PHP 5.3.0 compiled with the “fileinfo” extension for more secure file uploads – read more at the change log for version 2.7.3)\n\njQuery 1.5.2+\n\n## How to use\n\n##### The HTML\n\n```html\n\u003c!-- must be in strict mode! --\u003e\n\u003c!DOCTYPE html\u003e\n\n\u003chtml\u003e\n\n    \u003chead\u003e\n\n        \u003ctitle\u003eZebra_Form Example\u003c/title\u003e\n\n        \u003cmeta charset=\"utf-8\"\u003e\n\n        \u003c!-- load Zebra_Form's stylesheet file --\u003e\n        \u003clink rel=\"stylesheet\" href=\"path/to/zebra_form.css\"\u003e\n\n    \u003c/head\u003e\n\n    \u003cbody\u003e\n\n        \u003c!-- the PHP code below goes here --\u003e\n\n        \u003c!-- load jQuery --\u003e\n        \u003cscript src=\"path/to/jquery.js\"\u003e\u003c/script\u003e\n\n        \u003c!-- load Zebra_Form's JavaScript file --\u003e\n        \u003cscript src=\"path/to/zebra_form.js\"\u003e\u003c/script\u003e\n\n    \u003c/body\u003e\n\n\u003c/html\u003e\n```\n\n##### The PHP\n\n```php\n// include the Zebra_Form class\nrequire 'path/to/Zebra_Form.php';\n\n// instantiate a Zebra_Form object\n$form = new Zebra_Form('form');\n\n// the label for the \"email\" field\n$form-\u003eadd('label', 'label_email', 'email', 'Email');\n\n// add the \"email\" field\n$obj = $form-\u003eadd('text', 'email', '', array('autocomplete' =\u003e 'off'));\n\n// set rules\n$obj-\u003eset_rule(array(\n\n    // error messages will be sent to a variable called \"error\", usable in custom templates\n    'required'  =\u003e  array('error', 'Email is required!'),\n    'email'     =\u003e  array('error', 'Email address seems to be invalid!'),\n\n));\n\n// \"password\"\n$form-\u003eadd('label', 'label_password', 'password', 'Password');\n\n$obj = $form-\u003eadd('password', 'password', '', array('autocomplete' =\u003e 'off'));\n\n$obj-\u003eset_rule(array(\n\n    'required'  =\u003e array('error', 'Password is required!'),\n    'length'    =\u003e array(6, 10, 'error', 'The password must have between 6 and 10 characters'),\n\n));\n\n// \"remember me\"\n$form-\u003eadd('checkbox', 'remember_me', 'yes');\n\n$form-\u003eadd('label', 'label_remember_me_yes', 'remember_me_yes', 'Remember me');\n\n// \"submit\"\n$form-\u003eadd('submit', 'btnsubmit', 'Submit');\n\n// validate the form\nif ($form-\u003evalidate()) {\n\n    // do stuff here\n\n}\n\n// auto generate output, labels above form elements\n$form-\u003erender();\n```\n\nFor demos and more information visit the **[project's homepage](http://stefangabos.ro/php-libraries/zebra-form/)**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefangabos%2Fzebra_form","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstefangabos%2Fzebra_form","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefangabos%2Fzebra_form/lists"}