Download the PHP package voku/html-form-validator without Composer
On this page you can find all versions of the php package voku/html-form-validator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package html-form-validator
:flashlight: HTMLFormValidation
Description
HtmlFormValidator is a very easy to use PHP library that will help you to validate your data and you can use this independent from your framework of choice.
Install via "composer require"
How does this work?
-
First you need to generate a html form, that's completely your part. You can write it manually or you can generate with a framework or a library, it doesn't matter.
-
Then we use DOM Parsing via voku/simple_html_dom, to detect the current validator and filter rules directly from the html.
- And finally, we use Respect/Validation to validate the form.
Simple Example
Extended Example
Validator
You can use all validators from here.
e.g.: || (you need to lowercase the first letter from the class or you can use the class name itself)
You can combine validators simply via "|" ...
e.g.:
PS: you can add arguments comma separated or you can use serialize -> something like that ->
If you want to use the HTML5 validation e.g. for min or max values, or for e.g. email then you can use "auto".
e.g.:
By default we limit the submitted values to the values from the form e.g. for checkboxes, radios or select boxes. If you need to disable this, you can use "non-strict". (not recommended)
e.g.:
By default we use the error messages from the validation exception class, but you can use your own error messages via: "data-error-message--RULE_NAME_HERE" in the html.
e.g.:
By default we don't add error messages into html output, but you can add the error messages with a css selector:
e.g.:
By default we also don't add error classes, but you can add a new error class via:
e.g.
And if you need a more complex validation, then you can add simple-custom validations.
e.g.:
And if you need really complex validation, then you can create your own classes.
e.g.:
Filter
You can also use some simple filters, that will be applied on the input-data.
- trim
- escape (htmlentities with ENT_QUOTES | ENT_HTML5)
- ... and all methods from here
e.g.:
PS: the first argument will be the submitted value from the user
And also here you can combine some filters simply via "|" ...
e.g.:
... and you can also add custom filters by your own.
e.g.:
Unit Test
1) Composer is a prerequisite for running the tests.
2) The tests can be executed by running this command from the root directory:
Support
For support and donations please visit Github | Issues | PayPal | Patreon.
For status updates and release announcements please visit Releases | Twitter | Patreon.
For professional support please contact me.
Thanks
- Thanks to GitHub (Microsoft) for hosting the code and a good infrastructure including Issues-Managment, etc.
- Thanks to IntelliJ as they make the best IDEs for PHP and they gave me an open source license for PhpStorm!
- Thanks to Travis CI for being the most awesome, easiest continous integration tool out there!
- Thanks to StyleCI for the simple but powerfull code style check.
- Thanks to PHPStan && Psalm for relly great Static analysis tools and for discover bugs in the code!
All versions of html-form-validator with dependencies
respect/validation Version ~2.2
voku/email-check Version ~3.1
voku/simple_html_dom Version ~4.7
voku/portable-utf8 Version ~6.0