Skip to content

About

Bootstrap helpers for CakePHP

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Bootstrap helpers

License

A CakePHP plugin with Bootstrap 5 view helpers for building responsive UI components.

Requirements

  • PHP 8.1+
  • CakePHP 5.3+

Installation

You can install this plugin using Composer:

composer require brammo/bootstrap-ui

Load the Plugin

Add the following to your Application.php:

public function bootstrap(): void
{
    parent::bootstrap();
    
    $this->addPlugin('Brammo/BootstrapUI');
}

Or load via command line:

bin/cake plugin load Brammo/BootstrapUI

Usage

Load the helpers in your AppView.php:

public function initialize(): void
{
    parent::initialize();
    
    // Load individual helpers
    $this->loadHelper('Brammo/BootstrapUI.Card');
    $this->loadHelper('Brammo/BootstrapUI.Table');
    $this->loadHelper('Brammo/BootstrapUI.Description');
    $this->loadHelper('Brammo/BootstrapUI.Nav');
    $this->loadHelper('Brammo/BootstrapUI.Carousel');
    $this->loadHelper('Brammo/BootstrapUI.Badge');
    $this->loadHelper('Brammo/BootstrapUI.Icon');
}

NavHelper renders icons with IconHelper and builds array URLs with CakePHP’s Url helper. Load Icon when you render icons outside nav items. Configure its namespace and prefix to change the default icon set (see docs/icon.md).

View Helpers

The plugin provides several view helpers. All helpers use CakePHP's StringTemplateTrait for flexible template customization.

Helper Description Documentation
CardHelper Bootstrap cards with optional header and footer docs/card.md
TableHelper Responsive HTML tables with headers and rows docs/table.md
DescriptionHelper Description lists (<dl>) for key-value pairs docs/description.md
NavHelper Nav tabs/pills with tab panels or links docs/nav.md
CarouselHelper Carousels with controls, indicators, and captions docs/carousel.md
BadgeHelper Badges, color shortcuts, and button notification badges docs/badge.md
IconHelper Icon-font markup for Bootstrap Icons, Font Awesome, Tabler, and other sets docs/icon.md

See docs/template-customization.md for customizing helper templates at runtime or via configuration.

Tests

Run the test suite with PHPUnit:

composer test

Code Quality

Run code style checks:

composer cs-check

Fix code style issues:

composer cs-fix

Static Analysis

Run PHPStan and Psalm:

composer analyse

Or run them individually:

composer stan
composer psalm

License

This plugin is licensed under the MIT License.

Author

Roman Sidorkin - roman.sidorkin@gmail.com

About

Bootstrap helpers for CakePHP

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages