Download the PHP package webup/laravel-form without Composer
On this page you can find all versions of the php package webup/laravel-form. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download webup/laravel-form
More information about webup/laravel-form
Files in webup/laravel-form
Package laravel-form
Short Description A Laravel package to help build forms.
License MIT
Homepage https://github.com/agence-webup/laravel-form
Informations about the package laravel-form
laravel-form
Install
Step 1: Install via Composer
Step 2: Add the Service Provider
Add this line to config/app.php:
Step 3: Use Facade (optional)
For shorter code, you can use the facade by adding this line to config/app.php:
You can now use Laravel Form directly into your views (check some examples bellow)
Step 4: Publish config
You can publish config and override it in config/form.php:
Using
Methods
These methods can be used with any type of elements:
- label($label = null, $escape = true)
- value($value = null)
- placeholder($placeholder = null)
- name($name = null)
- required($showStar = true)
- errors($errors = [])
- attr(array $attr = [])
- wrapperAttr(array $attr = [])
- wrapperClass($wrapperClass) deprecated use wrapperAttr(['class' => 'myclass'])
Generated HTML
Without errors:
With errors (retrieve from Laravel validation):
You can override default CSS class in config/form.php.
Important: Laravel Form can handle HTML generation and client side validation only. You need to manage server side validation on your own.
Elements
input
textarea
radio
Specific methods :
- addRadio($value, $label, $id, $attr = [])
select
Specific methods :
- addOptions(array $options)
checkbox
You can use ->attr(['value' => '1'])
to change the value of the checkbox
AntiSpam feature
Honeypot
Will create an input text
with name='unicorn_mail'
within a hidden div (by javascript)
Validation
TimeTrap
Will create an input text
with name='unicorn_time'
and value="{encryptedTimestamp}"
within a hidden div (by javascript)
Validation
In this example, timetrap time is set to 2
seconds. If no value is set, config form.antiSpam.minFormSubmitTime
is taken. Finally if config form.antiSpam.minFormSubmitTime
is not set, default value is 3
seconds.
Styling
Bellow, you will find default styles that can work with Laravel Form.
Contributing
Please see CONDUCT for details.
Credits
Developed by Agence Webup
License
The MIT License (MIT). Please see License File for more information.