Set of Twitter Bootstrap 5 rendering objects
desktop applicationUtilityapt install php-vitexsoftware-ease-twbootstrap5TWB5 classes for Ease Framework. HTML classes for Ease Framework documentation generated by apigen
TwitterBootstrap5 classes for EasePHP Framework
Note: If you are looking for a similar PHP library for Bootstrap 4, you can find it at php-ease-twbootstrap4. Migrating from Bootstrap 4? See the Upgrade Guide.
A comprehensive set of PHP classes for building Bootstrap 5 UI components within the EasePHP Framework. Each class wraps a specific Bootstrap 5 component and generates the correct HTML structure and CSS classes automatically.
Targets Bootstrap 5.3.
addAccordionItem(); supports alwaysOpen mode (multiple sections open simultaneously).use Ease\TWB5\Accordion;
$accordion = new Accordion('faq', [
'What is Bootstrap?' => 'A CSS framework.',
'What is EasePHP?' => 'A PHP rendering library.',
]);
$accordion->addAccordionItem('Custom item', 'Added programmatically.', true);
echo $accordion->draw();
success, danger, warning, info, primary, secondary, light, dark).use Ease\TWB5\Alert;
$alert = new Alert('success', 'Operation completed successfully!');
echo $alert->draw();
text-bg-* classes.use Ease\TWB5\Badge;
$badge = new Badge('New', 'primary');
echo $badge->draw();
['Label' => 'url'] pairs; the last item is automatically marked active.use Ease\TWB5\Breadcrumb;
$breadcrumb = new Breadcrumb([
'Home' => '/',
'Library' => '/library',
'Data' => '',
]);
echo $breadcrumb->draw();
lg, sm), vertical stacking.use Ease\TWB5\ButtonGroup;
use Ease\Html\ButtonTag;
$group = new ButtonGroup([
new ButtonTag('Left', ['class' => 'btn btn-primary']),
new ButtonTag('Middle', ['class' => 'btn btn-primary']),
new ButtonTag('Right', ['class' => 'btn btn-primary']),
], '', false, 'Toolbar');
echo $group->draw();
Panel for a structured header/body/footer layout.use Ease\TWB5\Card;
$card = new Card('This is the card body content.');
echo $card->draw();
xs, sm, md, lg, xl, xxl).triggerButton() returns a ready-made toggle button; supports open-by-default state.use Ease\TWB5\Collapse;
$collapse = new Collapse('details', 'Hidden content revealed on click.');
echo $collapse->triggerButton('Show details')->draw();
echo $collapse->draw();
use Ease\TWB5\Container;
$container = new Container('This is a container.');
echo $container->draw();
form-control to added inputs; use addInput() for labelled input groups.use Ease\TWB5\Form;
use Ease\Html\InputTextTag;
$form = new Form(['method' => 'POST', 'action' => '/submit']);
$form->addInput(new InputTextTag('username'), 'Username');
echo $form->draw();
<a>) buttons.primary, secondary, success, danger, warning, info, light, dark, link); defaults to secondary.use Ease\TWB5\LinkButton;
$linkButton = new LinkButton('https://example.com', 'Click Me', 'primary');
echo $linkButton->draw();
['label' => 'url']; flush and numbered variants; addListItem() for contextual colors and active state.use Ease\TWB5\ListGroup;
$list = new ListGroup([
'Settings' => '/settings',
'Profile' => '/profile',
]);
$list->addListItem('Notifications', 'warning');
echo $list->draw();
triggerButton() returns a ready-made button; optional footer; size variants (sm, lg, xl); public $header, $body, $footer for further customisation.use Ease\TWB5\Modal;
$modal = new Modal('confirmDelete', 'Confirm', 'Are you sure?', 'This cannot be undone.');
echo $modal->triggerButton('Delete', 'danger')->draw();
echo $modal->draw();
addNavItem() for active/disabled states.use Ease\TWB5\Nav;
$nav = new Nav([
'Home' => '/',
'About' => '/about',
'Contact' => '/contact',
], 'tabs');
echo $nav->draw();
addDropdownItem().use Ease\TWB5\NavItemDropDown;
$dropdown = new NavItemDropDown('More', [
'Action' => '#action',
'Another action'=> '#another-action',
'' => '', // divider
'Something else'=> '#else',
]);
echo $dropdown->draw();
use Ease\TWB5\Navbar;
$navbar = new Navbar('My Website', [
'Home' => '#home',
'About' => '#about',
]);
echo $navbar->draw();
use Ease\TWB5\OffCanvas;
$offcanvas = new OffCanvas('sidebar', 'Slide-in Menu', 'Panel body content here.');
echo $offcanvas->draw();
lg, sm).use Ease\TWB5\Pagination;
$pagination = new Pagination(3, 10, '?page=%d');
echo $pagination->draw();
Card; contextual background colors (success, warning, info, danger); sections only render when they contain content; addItem() inserts into the body.use Ease\TWB5\Panel;
$panel = new Panel('Panel Heading', 'success', 'Panel body content.', 'Panel footer');
$panel->addItem('More body content');
echo $panel->draw();
twBootstrapize() to apply Bootstrap styling to arbitrary HTML elements.use Ease\TWB5\Progress;
$progress = new Progress(65, 0, 100, 'success');
echo $progress->draw();
// Striped and animated
$progress = new Progress(40, 0, 100, 'warning', true, true, '40%');
echo $progress->draw();
addColumn() shortcut creates a Col inside the row.use Ease\TWB5\Row;
use Ease\TWB5\Col;
$row = new Row([
new Col(6, 'Left column'),
new Col(6, 'Right column'),
]);
echo $row->draw();
border (ring) and grow (pulsing dot) types; all contextual colors; small size variant.use Ease\TWB5\Spinner;
echo (new Spinner())->draw(); // default border, primary
echo (new Spinner('grow', 'success', 'sm'))->draw(); // small growing dot, green
use Ease\TWB5\SubmitButton;
$submit = new SubmitButton('Save changes', 'primary');
echo $submit->draw();
use Ease\TWB5\Table;
$table = new Table([
['Name', 'Score'],
['Alice', '95'],
['Bob', '87'],
]);
echo $table->draw();
addTab(); AJAX/dynamic content loading via addAjaxTab(); first tab active by default.use Ease\TWB5\Tabs;
$tabs = new Tabs();
$tabs->addTab('Overview', 'Overview content here.', true);
$tabs->addTab('Details', 'Details content here.');
$tabs->addAjaxTab('Live', '/api/live-data');
echo $tabs->draw();
use Ease\TWB5\Toast;
$toast = new Toast('Notification', 'Your file was saved.', 'Just now');
echo $toast->draw();
// Persistent (no auto-hide)
$toast = new Toast('Warning', 'Action required.', null, false);
echo $toast->draw();
use Ease\TWB5\WebPage;
use Ease\TWB5\Container;
$page = new WebPage('My Web Page');
$page->addItem(new Container('Main content goes here.'));
echo $page->draw();
composer require vitexsoftware/ease-twbootstrap5
Or add to composer.json manually:
{
"require": {
"vitexsoftware/ease-twbootstrap5": "^1.0"
}
}
Then include the autoloader:
require 'vendor/autoload.php';
This package may not be indexed in our database yet. Please try again later or check the package repository directly.