Download the PHP package form-manager/form-manager without Composer
On this page you can find all versions of the php package form-manager/form-manager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download form-manager/form-manager
More information about form-manager/form-manager
Files in form-manager/form-manager
Package form-manager
Short Description PHP-HTML form manager
License MIT
Homepage https://github.com/oscarotero/form-manager
Informations about the package form-manager
FormManager
Note: this is the documentation of FormManager 6.x
For v5.x version Click here
Installation:
This package requires PHP>=7.1
and is available on Packagist:
Create a field
FormManager is namespaced, but you only need to import a single class into your context:
Use the imported factory to create all form elements:
List of all available inputs:
All HTML5 field types are supported:
F::checkbox($label, $attributes)
F::color($label, $attributes)
F::date($label, $attributes)
F::datetimeLocal($label, $attributes)
F::email($label, $attributes)
F::file($label, $attributes)
F::hidden($value, $attributes)
F::month($label, $attributes)
F::number($label, $attributes)
F::password($label, $attributes)
F::radio($label, $attributes)
F::range($label, $attributes)
F::search($label, $attributes)
F::select($label, $options, $attributes)
F::submit($label, $attributes)
F::tel($label, $attributes)
F::text($label, $attributes)
F::textarea($label, $attributes)
F::time($label, $attributes)
F::url($label, $attributes)
F::week($label, $attributes)
Note that all inputs accepts the same arguments except
hidden
andselect
.
Validation
This library uses internally symfony/validation to perform basic html5 validations and error reporting. HTML5 validation attributes like required
, maxlength
, minlength
, pattern
, etc are supported, in addition to intrinsic validations assigned to each input like email, url, date, etc.
See all constraints supported by symfony
Render html
Set a custom template using {{ label }}
and {{ input }}
placeholders:
If you want to wrap the previous template in a custom html, use the {{ template }}
placeholder:
Grouping fields
Group the fields to follow a specific data structure:
Group
Groups allow to place a set of inputs under an specific name:
Radio group
Special case for radios where all inputs share the same name with different values:
Submit group
Special case to group several submit buttons under the same name but different values:
Group collection
Is a collection of values using the same group:
Multiple group collection
Is a collection of values using various groups, using the field type
to identify which group is used by each row:
Datalist
Datalist are also allowed, just use the createDatalist()
method:
Forms
We need a form to put all this things together.