Download the PHP package ilyasavich/form-builder without Composer
On this page you can find all versions of the php package ilyasavich/form-builder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ilyasavich/form-builder
More information about ilyasavich/form-builder
Files in ilyasavich/form-builder
Package form-builder
Short Description The form builder service for laravel app
License MIT
Informations about the package form-builder
Laravel Form Builder
The form builder service for Laravel
Installation
Require
Register Provider and Facade
Publish config
Usage
To create new form first of all extending base Form
class and overwrite method make
.
This method implements form building logic
Create inputs
The package provide to create all available html inputs.
To add new input in your form class you need call add
method of builder instance.
It signature
To create simple input write ...
Customization
Attributes
Here are several methods to customize input
Labels
Group customization
By default inputs will generating in such format
If you don't need to wrap input by group
You can customize group attributes
Overwrite views
If you need specific input generating you can overwrite default view by your custom
In case where you need to overwrite view without group you can ...
When you need to overwrite only group you can ...
In view you have $input
object that is an instance of your input class.
Available input properties
The you can find list of available properties of $input
object
Name | Description |
---|---|
$name |
Input name |
$value |
Input value |
$attributes |
Input attributes |
$label |
Input label in html |
$view |
Path to input group view. Will be null if you don't set it in view() method |
$defaultView |
Path to default group view. You can set it in config file |
$groupAttributes |
Array of group attributes |
$before |
Array of inputs that must be inserted inside group before current |
$after |
Array of inputs that must be inserted inside group after current |
$withoutGroup |
Can be set by call withoutGroup() method. Indicates that need generate input without wrapping group |
$withoutGroupView |
Path to view inside group |
$model |
Model that will be binding for input |
Create simple form
For example you need to create simple login form with at least two inputs. Ok, it will something like that
After that you need to add this form in controller action
And, finally, render form in view file
Lets create action for submitting login form. In our controller