/laravel-bootstrap

Expand Blade to generate Twitter Bootstrap code

Primary LanguagePHPMIT LicenseMIT

Laravel - Bootstrap

Generate Twitter Bootstrap code

Installation

Add LaravelBootstrap to your composer.json file to require :

require : {
    "laravel/framework": "5.3.*",
    "michael-lurquin/laravel-bootstrap": "dev"
}

Update Composer :

composer update

The next required step is to add the service provider to config/app.php :

Lurquinm\LaravelBootstrap\LaravelBootstrapServiceProvider::class,

Publish

The last required step is to publish views and assets in your application with :

php artisan vendor:publish

Congratulations, you have successfully installed LaravelBootstrap !

License

The MIT License (MIT). Please see License File for more information.

Documentation

Syntax

Name Options Optionnal Extras
glyph icon NO
button label NO
class YES : 'default'
attributes YES : array(attr => value)
ahref url NO
label NO
class YES
glyph YES
attributes YES : array(attr => value)
alert message NO
title YES
class YES = 'danger'
glyph YES
close YES : 'TRUE'
dropdown label NO
links YES : array(url => label)
id YES : 'dropdownMenu1' array('divider', 'dropdown-header', 'disabled', 'active')
openBottom YES : TRUE
buttonToolbar buttons NO array(url => label)
classActive YES : 'primary'
classNotActive YES : 'default'
sizeButton YES array('btn-group-lg', 'btn-group-sm', 'btn-group-xs')
ariaLabel YES

Examples

List of commands with the minimum number of parameters and which increases progressively.

{!! Bootstrap::glyph('star') !!} // <span class='glyphicon glyphicon-star' aria-hidden='true'></span>

{!! Bootstrap::button('Je suis un bouton') !!}
{!! Bootstrap::button('Je suis un bouton', 'primary') !!}
{!! Bootstrap::button('Je suis un bouton', 'primary', ['id' => 'btnOk']) !!}
{!! Bootstrap::button('Je suis un bouton', 'primary', ['id' => 'btnOk', 'glyph' => 'globe']) !!}

{!! Bootstrap::ahref('/edit', 'Edit', 'primary', 'pencil') !!}

{!! Bootstrap::alert('Enter a valid email address', 'Error', 'danger', 'star', FALSE) !!}

{!! Bootstrap::dropdown('Dropdown', ['dropdown-header' => 'Header', '/home' => 'Home', 'divider' => '', 'active' => 'About'], 'primary', 'dropdownMenu1', FALSE) !!}

{!! Bootstrap::buttonToolbar(['/home' => 'Left', 'active' => 'Middle', '/about' => 'Right'], 'danger', 'default') !!}