Download the PHP package barbuslex/bootforms without Composer
On this page you can find all versions of the php package barbuslex/bootforms. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download barbuslex/bootforms
More information about barbuslex/bootforms
Files in barbuslex/bootforms
Package bootforms
Short Description Just a Formbuilder with some Bootstrap specific conveniences. Remembers old input, retrieves error messages and handles all your boilerplate Bootstrap markup automatically. (Based on adamwathan/bootforms)
License MIT
Informations about the package bootforms
BootForms
Based on adamwathan/bootforms with bugfix and Laravel 4 normalization :
Use :
Insted Of:
BootForms builds on top of my more general Form package by adding another layer of abstraction to rapidly generate markup for standard Bootstrap 3 forms. Probably not perfect for your super custom branded ready-for-release apps, but a huge time saver when you are still in the prototyping stage!
Installing with Composer
You can install this package via Composer by including the following in your composer.json
:
Note: you could also require dev-master
to test the latest version, but make sure you drop your minimum-stability
to dev
.
Laravel 4
If you are using Laravel 4, you can get started very quickly by registering the included service provider.
Modify the providers
array in app/config/app.php
to include the BootFormsServiceProvider
:
Add the BootForm
facade to the aliases
array in app/config/app.php
:
You can now start using BootForms by calling methods directly on the BootForm
facade:
Outside of Laravel 4
Usage outside of Laravel 4 is a little trickier since there's a bit of a dependency stack you need to build up, but it's not too tricky.
Note: You must provide your own implementations of
AdamWathan\Form\OldInputInterface
andAdamWathan\Form\ErrorStoreInterface
when not using the implementations meant for Laravel 4.
Using BootForms
Reduced Boilerplate
Typical Bootstrap form boilerplate might look something like this:
Using the Laravel 4 FormBuilder
, you would normally be able to get that down to this:
BootForms makes a few decisions for you and allows you to pare it down a bit more:
Automatic Validation State
Another nice thing about BootForms is that it will automatically add error states and error messages to your controls if it sees an error for that control in the error store.
Essentially, this takes code that would normally look like this:
And reduces it to this:
...with the has-error
class being added automatically if there is an error in the session.
Horizontal Forms
To use a horizontal form instead of the standard basic form, simply swap the BootForm::open()
call:
Customizing Form Elements
If you need to customize your form elements in any way (such as adding a default value or placeholder to a text element), simply chain the calls you need to make and they will fall through to the underlying form element:
For more information about what's possible, check out the documentation for my basic Form package.