Bootstrap 4 component helpers
Utility wrapper classes for the Bootstrap 4 view helpers in my ZF3-view-helpers library (https://github.com/deanblackborough/zf3-view-helpers), allows usage of the view helpers in any PHP site, not just Zend Framework apps.
The easiest way to use the view helpers is via composer, composer require deanblackborough/bootstrap-4-helpers,
alternatively include the classes in src/ in your library.
Create a view helper is a two step process, you need to call the ViewHelper factory to create the relevant view helper and then you can chain the helpers methods to create your component.
$jumbotron = ViewHelper::jumbotron('Heading', '<p>Content</p>');
echo $jumbotron->fluid()->setBgStyle('primary');
$alert = ViewHelper::alert('Alert message');
setBgStyle(string $color)- Set the background coloursetHeading(string $heading, int $heading_level)- Set optional headingsetTextStyle(string $color)- Set the text colour
$badge = ViewHelper::badge('Label');
asLink()- As linkpill()- Display as pillsetBgStyle(string $color)- Set the background coloursetTextStyle(string $color)- Set the text colour
$button = ViewHelper::button('Label');
active()- Activeblock()- Display as a full width blockcustomClass(string $class)- Add a custom classdisabled()- Set disabledlarge()- Large buttonsetBgStyle(string $color)- Set the background coloursetModeButton()- Render as a buttonsetModeInput()- Render as an inputsetOutlineStyle()- Outline buttonsetUri(string $uri)- Set URIsmall()- Small button
$column = ViewHelper::column('<p>Content</p>');
lg(int $size)- Set lg column widthmd(int $size)- Set md column widthsetBgStyle(string $color)- Set the background coloursetTextStyle(string $color)- Set the text coloursm(int $size)- Set sm column widthxl(int $size)- Set xl column widthxs(int $size)- Set xs column width
$jumbotron = ViewHelper::jumbotron('Heading', '<p>Content</p>');
fluid()- Add fluid classsetBgStyle(string $color)- Set the background coloursetHeadingDisplayLevel(int $level)- Set the display levelsetSubHeading(string $sub_heading)- Set an optional sub headingsetTextStyle(string $color)- Set the text colour
$progressBar = ViewHelper::progressBar(25);
animate()- AnimatesetBgStyle(string $color)- Set the background coloursetHeight(int $height)- Set heightsetLabel(string $label)- Set a labelsetTextStyle(string $color)- Set the text colourstriped()- Striped background
$row = ViewHelper::row('<div class="col-6"></div>');
setBgStyle(string $color)- Set the background coloursetTextStyle(string $color)- Set the text colour
I'm not adding tests to this library, the tests for the functionality are within the https://github.com/deanblackborough/zf3-view-helpers library, this library simply makes it possible to use the view helpers outside of the Zend Framework, I've not added any additional functionality.