CakePHP 5 plugin that adds Bootstrap 5 view helpers.
| Path | Purpose |
|---|---|
src/View/Helper/ |
Card, Table, Description, Nav, Carousel, Badge, Icon helpers |
src/BootstrapUIPlugin.php |
Plugin class (no auto-registration of helpers) |
tests/TestCase/View/Helper/ |
PHPUnit tests (1:1 with helpers) |
README.md |
Installation, loading helpers, links to docs |
docs/ |
Per-helper API and usage (card.md, table.md, …) |
composer test # PHPUnit
composer cs-check # PHPCS (src + tests)
composer check # test + cs-check
composer analyse # PHPStan (level 8, src/) + PsalmRun composer check after helper or test changes. Run composer analyse before larger refactors.
BootstrapUIPlugin does not register helpers. Host apps must:
$this->addPlugin('Brammo/BootstrapUI')inApplication.php$this->loadHelper('Brammo/BootstrapUI.Card')(and Table, Description, Nav, Carousel, Badge, Icon) inAppView::initialize()
NavHelper uses IconHelper for icons and CakePHP's Url helper for array URLs.
- PHP 8.1+,
declare(strict_types=1);, namespaceBrammo\BootstrapUI\... - Helpers use
StringTemplateTrait, configurable templates, andmergeAttributes()for defaults - Fluent helpers (Table, Description, Nav) reset internal state in
render() - Every behavior change needs a matching test in
tests/TestCase/View/Helper/ - Assert Bootstrap markup (classes, ARIA,
data-bs-*), not only content substrings - Do not commit unless the user asks
- Update the matching file in
docs/(andREADME.mdif install/usage changes) when public options or behavior change
See .cursor/rules/ for file-specific guidance (bootstrap-ui.mdc, view-helpers.mdc, helper-tests.mdc).