Download the PHP package maplephp/form without Composer
On this page you can find all versions of the php package maplephp/form. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download maplephp/form
More information about maplephp/form
Files in maplephp/form
Package form
Short Description Develop advanced, consistent, and secure forms that are also very easy to validate.
License Apache-2.0
Homepage https://wazabii.se
Informations about the package form
MaplePHP - Form builder
Create advanced, consistent and secure forms and validations.
1. Initiate
It is recommended that you make a copy off AbstractFormFields class, make it to a regualar class, rename it and extend it to the real AbstractFormFields abstract class. Then you can start making and adding your own custom input fields.
Basic: You can either quick create one field form the fields template
$fields->[FIELD_TYPE]->[ARG1]->[ARG2]->get(); FIELD_TYPE: Method name from Form\Templates\Fields ARG: Chainable arguments like input name, fields attributes, validations and so on.
Advance:
Use the form compiler for advance consistent form creation and validation. Works really great in frameworks and large applications.
Create fields
Field config
type (string)
Expects defined form type key Example: text, textarea, date, select, checkbox, radio and more. Required
label (string)
Define a input label Example: Email address
description (string)
Define a input label Example: We need your email to…
attr (array)
Add html attributens to field Example:
items (array)
Add checkbox, radio or select list items. Example:
Is required for field types like select, checkbox and radio.
validate (array)
Add validation to form field Example:
The exclamation point before the email key means that it will only validate email if it is filled in else skip or do the other validation.
config (multidimensional array)
Pass on custom data for a custom field. Example:
Examples:
1. Create form with array
Build a whole form with array as bellow
2. Set values if you want
If you have values from for example the database (accepts multidimensional array and object)
3. Build the form
You will allways need to build the form before read or validations.
4. Read form
Now you can read the form.
5. Validate form
Now you can read the form.