jorisvaesen/bootstrap-3-ui

Bootstrap front-end framework support for CakePHP

Installs: 49 844

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 1

Type:cakephp-plugin

1.4.1 2019-02-18 15:33 UTC

README

Transparently use Bootstrap 3 with CakePHP 3.

Allow usage of bootstrap 3 and 4 in the same project

This repository is in sync with FriendsOfCake/bootstrap-ui 1.x releases and uses another namespace to allow installation of this package for bootstrap 3 and FriendsOfCake/bootstrap-ui 2.x for bootstrap 4 in the same project.

composer require jorisvaesen/bootstrap-3-ui
composer require friendsofcake/bootstrap-ui:2.0.0-beta4

Usage

The easiest way to use bootstrap 3 and 4 in your CakePHP project is to create an extra AppView for bootstrap 4.

Edit your current AppView.php to start using this package:

// AppView.php

use Bootstrap3UI\View\UIViewTrait;

class AppView extends View
{
    use UIViewTrait;
    
    public function initialize()
    {
    	parent::initialize();
        
        $this->initializeUI();
    }

Create an AppView for pages which use bootstrap 4:

// AppView4.php

use BootstrapUI\View\UIViewTrait;

class AppView4 extends View
{
    use UIViewTrait;
    
    public function initialize()
    {
    	parent::initialize();
        
        $this->initializeUI();
    }

Load bootstrap 3 or bootstrap 4 helpers through the AppView:

// In any controller initialize() or any action
$this->viewBuilder()
    ->setClassName('App\View\AppView')      // Bootstrap 3
    ->setClassName('App\View\AppView4')     // Bootstrap 4