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
Form Manager
Note: this is the documentation of FormManager 7.x
For v6.x version Click here
Installation:
This package requires PHP>=7.2 and is available on Packagist:
Supports symfony/validator v5, v6 and v7.
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
hiddenandselect.
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 supported constraints by symfony/validation.
Translations
This package allows you to set your custom Validation instance with Factory::setValidator().
This allows you to use symfony/translations in order to have translations in place.
See examples/translations.php to see the full example.
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:
If you need the radio group to be required, you should add the required attribute to at least one radio button:
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
Datalists are also allowed, just use the createDatalist() method:
Forms
We need a form to put all this things together.
Please see CONTRIBUTING for contributing details.
The MIT License (MIT). Please see LICENSE for more information.