Download the PHP package plokko/formbuilder without Composer
On this page you can find all versions of the php package plokko/formbuilder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package formbuilder
FormBuilder
Laravel Helper module for creating forms and input fields Version 0.2 Beta
Changelog
- 0.2 beta - Rewritten from scratch, not compatible with previus versions
Installation
-
Require with composer
- Add the provider and facades in the app config file /config/app.php
Use
- create the FormBuilder instance First create a new instance of FormBuilder in your view with the make command and assign it to a variable
The make function accepts the same parameters as laravelcollective/html Form::open
-
declaring the fields You can then add fields using the requested field type as method name and field name as value
- Accessing the fields
To set the options to the field you can access the field when declared
or you can retrieve it later by accessing it by name as a parameter or array
If you try to access and undeclared field the field will be automatically declared as a text field
- Render the form
To render the form you should first open and close the form using the openForm() and closeForm() functions, rendering the fields with the render() function between them.
Customization
Form view
You can specify how the form will be rendered by applying a view to the FormBuilder class
You can specify the view like following where $fields is an array containing all the defined fields
The view will be called with the render function.
Expanding functionalities
You can easly add or replace field types by changing the config file; to do so first publish the config
Then edit the /config/app.php file
You can create a new field type by expanding the plokko\FormBuilder\fields\FormField class like so:
and then adding it in the config file like so
You can then add the field using the declared name: