A generic php helper class for Twitter Bootstrap components.
Here is the demo for the currently available components
This helper is designed to be used in a generic PHP application (there is no wrapper for any CMS, but that may come if you want to do it :)). The class is easily expandable for your own custom components.
Include the class in your project and create a Tbs
object. Then, call it :)
<?php
include 'Tbs.php';
$Tbs = new Tbs;
The demo/index.php
file contains tests, you can open it in your browser... (it uses a boilerplate template from Initializr)
As the class is not totally finished, you are welcome to join the project !
- icon($icon, $options) Displays an icon
- Buttons:
- button($content, $url, $options) Displays a button
- buttonGroup($buttons, $options) Creates a group of buttons
- buttonDropdown($title, $content, $buttonOptions, $dropdownOptions, $options) Creates a dropdown button
- toolbar($buttonGroups, $options) * Creates a toolbar*
- dropdown($content, $options) Creates a dropdown menu
- label($content, $options) Creates a label
- badge($content, $options) Creates a badge
- alert($content, $options) Creates an alert block
- Forms:
- formOpen($name, $options) Opens a form
- input($name, $type, $value, $options) Creates an input element
- inputSelect($name, $list, $options) Creates a select element
- inputGroup()
- Help is wanted to find a way to do input groups and form-controls elements...
- input() is not totally completed as it lacks of some bootstrap functionnalities.
- formClose($options) Closes a form
- image($path, $options) Creates a responsive image
- breadcrumb($elements, $options) Creates a breadcrumb
- embed($content, $options) Creates a responsive embed element
- header($content, $subtext, $options) *Creates a header (big H1 with possible subtext)
- jumbotron($title, $content, $options) Creates a hero unit
- listgroup($items, $options) Creates nice panels
- media() Creates a media element: an image with some text
- mediaList($list, $options) Creates a nested media list
- nav($tabs, $options) Creates a navigation bar
- navItem($content, $options) Creates a single navigation item to use in nav()
- navbar($content, $options) Creates a navbar
- navbarBrand($content, $options) Creates a brand item for a navbar
- navbarLinks($links, $options) Creates a menu with given links
- navbarLink($caption, $url, $options) Create a link to feed navbarLinks()
- navbarForm($content, $options) Creates a form
- navbarButton($content, $options) Creates a navbar button
- navbarText($content, $options) Creates simple text to add in a navbar
- navbarTextLink($content, $options) *Creates a text link (not a button nor a menu link)
- pager()
- paginator($links, $options) Creates pagination links
- paginatorLink($title, $url, $options) Creates a link to use in pagination
- panel($content, $options) Creates a panel
- progressBar($percentage, $options) Creates a progress bar
- progressBarStack($bars) Creates a stack of progress bars
- thumbList($thumbnails, $options) Creates a list of given thumbnails
- thumbnail($src, $options) Creates a thumbnail
- well($content, $options) Creates a well element
- Javascript elements
- jAffix()
- jAlert()
- jButton()
- jCarousel()
- jCollapse()
- jModal()
- jPopover()
- jScrollspy()
- jTooltip()