PHP code example of barbuslex / bootforms

1. Go to this page and download the library: Download barbuslex/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/ */

    

barbuslex / bootforms example snippets


{{ BootForm::text(name, value) }}

{{ BootForm::text(value, name) }}

'providers' => array(
		//...
		'AdamWathan\BootForms\BootFormsServiceProvider'
	),

'aliases' => array(
		//...
		'BootForm' => 'AdamWathan\BootForms\Facades\BootForm'
	),

BootForm::text('email', 'Email');

$formBuilder = new AdamWathan\Form\FormBuilder;

$formBuilder->setOldInputProvider($myOldInputProvider);
$formBuilder->setErrorStore($myErrorStore);
$formBuilder->setToken($myCsrfToken);

$basicBootFormsBuilder = new AdamWathan\BootForms\BasicFormBuilder($formBuilder);
$horizontalBootFormsBuilder = new AdamWathan\BootForms\HorizontalFormBuilder($formBuilder);

$bootForm = new AdamWathan\BootForms\BootForm($basicBootFormsBuilder, $horizontalBootFormsBuilder);

{{ Form::open() }}
  <div class="form-group">
    {{ Form::label('first_name', 'First Name', array('class' => 'control_label')) }}
    {{ Form::text('first_name', null, array('class' => 'form-control')) }}
  </div>
  <div class="form-group">
    {{ Form::label('last_name', 'Last Name', array('class' => 'control_label')) }}
    {{ Form::text('last_name', null, array('class' => 'form-control')) }}
  </div>
  <div class="form-group">
    {{ Form::label('date_of_birth', 'Date of Birth', array('class' => 'control_label')) }}
    {{ Form::text('date_of_birth', null, array('class' => 'form-control')) }}
  </div>
  <div class="form-group">
    {{ Form::label('email', 'Email', array('class' => 'control_label')) }}
    {{ Form::email('email', null, array('class' => 'form-control')) }}
  </div>
  <div class="form-group">
    {{ Form::label('password', 'Password', array('class' => 'control_label')) }}
    {{ Form::password('password', array('class' => 'form-control')) }}
  </div>
  {{ Form::submit('Submit', array('class' => 'btn btn-default')) }}
{{ Form::close() }}

{{ BootForm::open() }}
	{{ 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() }}

<div class="form-group {{ $errors->has('first_name') ? 'has-error' : '' }}">
	<label class="control_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
$labelWidth = 2;
$controlWidth = 10;

{{ BootForm::openHorizontal($labelWidth, $controlWidth) }}
  {{ 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() }}

// <div class="form-group">
//    <label class="control_label" for="first_name">First Name</label>
//    <input type="text" class="form-control" id="first_name" placeholder="John Doe">
// </div>
BootForm::text('first_name', 'First Name')->placeholder('John Doe');