PHP code example of avengers / bootforms
1. Go to this page and download the library: Download avengers/bootforms library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
avengers / bootforms example snippets
'providers' => [
//...
'TheAvengers\BootForms\BootFormsServiceProvider'
],
'aliases' => [
//...
'BootForm' => 'TheAvengers\BootForms\Facades\BootForm'
],
BootForm::text('Email', 'email');
$formBuilder = new TheAvengers\Form\FormBuilder;
$formBuilder->setOldInputProvider($myOldInputProvider);
$formBuilder->setErrorStore($myErrorStore);
$formBuilder->setToken($myCsrfToken);
$basicBootFormsBuilder = new TheAvengers\BootForms\BasicFormBuilder($formBuilder);
$horizontalBootFormsBuilder = new TheAvengers\BootForms\HorizontalFormBuilder($formBuilder);
$bootForm = new TheAvengers\BootForms\BootForm($basicBootFormsBuilder, $horizontalBootFormsBuilder);
// <form method="POST">
// <div class="form-group">
// <label for="field_name">Field Label</label>
// <input type="text" class="form-control" id="field_name" name="field_name">
// </div>
// </form>
{!! BootForm::open() !!}
{!! BootForm::text('Field Label', 'field_name') !!}
{!! BootForm::close() !!}
// <div class="form-group">
// <label for="first_name">First Name</label>
// <input type="text" class="form-control" id="first_name" name="first_name" placeholder="John Doe">
// </div>
BootForm::text('First Name', 'first_name')->placeholder('John Doe');
// <div class="form-group">
// <label for="color">Color</label>
// <select class="form-control" id="color" name="color">
// <option value="red">Red</option>
// <option value="green" selected>Green</option>
// </select>
// </div>
BootForm::select('Color', 'color')->options(['red' => 'Red', 'green' => 'Green'])->select('green');
// <form method="GET" action="/users">
BootForm::open()->get()->action('/users');
// <div class="form-group">
// <label for="first_name">First Name</label>
// <input type="text" class="form-control" id="first_name" name="first_name" value="John Doe">
// </div>
BootForm::text('First Name', 'first_name')->defaultValue('John Doe');
{!! BootForm::open() !!}
{!! BootForm::text('First Name', 'first_name') !!}
{!! BootForm::text('Last Name', 'last_name') !!}
{!! BootForm::date('Date of Birth', 'date_of_birth') !!}
{!! BootForm::email('Email', 'email') !!}
{!! BootForm::password('Password', 'password') !!}
{!! BootForm::submit('Submit') !!}
{!! BootForm::close() !!}
<div class="form-group {!! $errors->has('first_name') ? 'has-error' : '' !!}">
<label for="first_name">First Name</label>
<input type="text" class="form-control" id="first_name">
{!! $errors->first('first_name', '<p class="help-block">:message</p>') !!}
</div>
{!! BootForm::text('First Name', 'first_name') !!}
// Width in columns of the left and right side
// for each breakpoint you'd like to specify.
$columnSizes = [
'sm' => [4, 8],
'lg' => [2, 10]
];
{!! BootForm::openHorizontal($columnSizes) !!}
{!! BootForm::text('First Name', 'first_name') !!}
{!! BootForm::text('Last Name', 'last_name') !!}
{!! BootForm::text('Date of Birth', 'date_of_birth') !!}
{!! BootForm::email('Email', 'email') !!}
{!! BootForm::password('Password', 'password') !!}
{!! BootForm::submit('Submit') !!}
{!! BootForm::close() !!}
BootForm::open()->action( route('users.update', $user) )->put()
BootForm::bind($user)
BootForm::close()