Download the PHP package jeylabs/larastrap without Composer

On this page you can find all versions of the php package jeylabs/larastrap. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package larastrap

BootstrapForm, forms for Laravel 5

Total Downloads Latest Stable Version Latest Unstable Version License

This is a package for simply creating Bootstrap 3 styled form groups in Laravel 5. It extends the normal form builder to provide you with horizontal form groups completed with labels, error messages and appropriate class usage.

Introduction

Simply use the BootstrapForm facade in the place of the Form facade when you want to generate a Bootstrap 3 form group.

BootstrapForm::text('username');

And you'll get back the following:

<div class="form-group">
    <label for="username" class="control-label col-md-2">Username</label>
    <div class="col-md-10">
        <input type="text" name="username" class="form-control">
    </div>
</div>

Of course, if there are errors for that field it will even populate them.

<div class="form-group has-error">
    <label for="username" class="control-label col-md-2">Username</label>
    <div class="col-md-10">
        <input type="text" name="username" class="form-control">
        <span class="help-block">The username field is required.</span>
    </div>
</div>

Installation

Simply pop this in your composer.json file and run composer update (however your Composer is installed).

"jeylabs/bootstrap-form": "dev-master"

Now, add these service providers to your app/config/app.php file.

'Collective\Html\HtmlServiceProvider',
'Jeylabs\BootstrapForm\BootstrapFormServiceProvider',

And finally add these to the aliases array (note: Form and Html must be listed before BootstrapForm):

'Form'=> 'Collective\Html\FormFacade',
'HTML'=> 'Collective\Html\HtmlFacade',
'BootstrapForm' => 'Jeylabs\BootstrapForm\Facades\BootstrapForm',

Feel free to use a different alias for BootstrapForm if you'd prefer something shorter.

Configuration

There are a number of configuration options available for BootstrapForm. Run the following Artisan command to publish the configuration option to your config directory:

php artisan vendor:publish

Horizontal form sizes

When using a horizontal form you can specify here the default sizes of the left and right columns. Note you can specify as many classes as you like for each column for improved mobile responsiveness, for example:

col-md-3 col-sm-6 col-xs-12

Display errors

By default this package will only display the first validation error for each field. If you'd instead like to list out all the validation errors for a field, simply set this configuration option to true.

Usage

Opening a form

BoostrapForm has improved the process of opening forms, both in terms of providing Bootstrap classes as well as managing models for model-based forms.

// Passing an existing, persisted model will trigger a model
// binded form.
$user = User::whereEmail('[email protected]')->first();

// Named routes
BootstrapForm::open(['model' => $user, 'store' => 'users.store', 'update' => 'users.update']);

// COntroller actions
BootstrapForm::open(['model' => $user, 'store' => 'UsersController@store', 'update' => 'UsersController@update']);

If a model is passed to the open method, it will be configured to use the update route with the PUT method. Otherwise it will point to the store method as a POST request. This way you can use the same opening tag for a form that handles creating and saving.

// Passing a model that hasn't been saved or a null value as the
// model value will trigger a `store` form.
$user = new User;

BoostrapForm::open()

Form variations

There are a few helpers for opening the different kinds of Bootstrap forms. By default, open() will use the the form style that you have set in the configuration file. These helpers take the same input as the open() method.

// Open a vertical Bootstrap form.
BootstrapForm::openVertical();

// Open an inline Bootstrap form.
BootstrapForm::openInline();

// Open a horizontal Bootstrap form.
BootstrapForm::openHorizontal();

If you want to change the columns for a form for a deviation from the settings in your configuration file, you can also set them through the $options array.

BootstrapForm::open(['left_column_class' => 'col-md-2', 'left_column_offset_clsas' => 'col-md-offset-2', 'right_column_class' => 'col-md-10'])

Text inputs

Here are the various methods for text inputs. Note that the method signatures are relatively close to those provided by the Laravel form builder but take a parameter for the form label.

// The label will be inferred as 'Username'.
BootstrapForm::text('username');

// The field name by default is 'email'.
BootstrapForm::email();

BootstrapForm::textarea('profile');

// The field name by default is 'password'.
BootstrapForm::password();

Checkbox and radio button inputs

Checkboxes and radio buttons are a little bit different and generate different markup. They support both the horizontal and inline layout of the inputs.

View the method signature for configuration options.

// A checked checkbox.
BootstrapForm::checkbox('interests', 'Laravel', 'laravel', true);

// An unchecked, but inline checkbox.
BootstrapForm::checkbox('interests', 'Rails', 'rails', null, true);

Same goes for radio inputs.

BootstrapForm::radio('gender', 'Male', 'male');

Multiple checkboxes and radio buttons

By simply passing an array of value/label pairs you can generate a group of checkboxes or radio buttons easily.

$label = 'this is just a label';

$interests = [
    'laravel' => 'Laravel',
    'rails'   => 'Rails',
    'ie6'     => 'Internet Explorer 6'
];

// Checkbox inputs with Laravel and Rails selected.
BootstrapForm::checkboxes('interests', $label, $interests, ['laravel', 'rails']);

$genders = [
    'male'   => 'Male',
    'female' => 'Female'
];

// Gender inputs inline, 'Gender' label inferred.
BootstrapForm::radios('gender', null, $genders, null, true);

// Gender inputs with female selected.
BootstrapForm::radios('gender', 'Gender', $genders, 'female');

Submit button

// Pretty simple.
BootstrapForm::submit('Login');

Closing the form

// Pretty simple.
BootstrapForm::close();

All versions of larastrap with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/config Version ~5.0
illuminate/session Version ~5.0
illuminate/support Version ~5.0
laravelcollective/html Version ~5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jeylabs/larastrap contains the following files

Loading the files please wait ....