Getting started

How to configure the library in your Yii Application

You basically have four options to include YiiBooster into your web application.

Installation by hand

Main foolproof method applicable to any type of a project is to get the latest end-user bundle of YiiBooster. Download it, unpack its contents to some directory inside your web application and proceed to "Configure" section below.

Download end-user bundle of YiiBooster

Installation by cloning the development repo

You can just clone our repository at GitHub into you web application, instead of relying on our end-user bundle. This way you'll get easy updates but you'll get a lot of development-specific stuff like build script and test harness, which you probably don't really need.

To install the full Github repository of YiiBooster into your project, issue the following command from the root of your codebase:

$ git clone git@github.com:clevertech/YiiBooster.git /path/to/desired/install/location

Note In development repository all production code is placed into the src subdirectory. It will affect your configuration of paths in "Configuration" section below.

Installation via Composer

Thanks to gureedo you can install YiiBooster using Composer.

The Composer configuration line for require section is "clevertech/yii-booster": "v3.0.0"

See details at YiiBooster page at Packagist.org.

Using the YiiBoilerplate project

We at Clevertech has another opensource project called YiiBoilerplate, which is the prepared skeleton web application we are using in our own workflow. YiiBoilerplate includes YiiBooster as one of it's extensions. All you need is probably configure it as specified in next section.

Download YiiBoilerplate package

Now, that we have placed the library where it belongs, lets configure it.

YiiBooster has the main component called Bootstrap (it's a legacy from the parent project called YiiBootstrap), which should be attached as a Yii application component.

So, the minimal configuration snippet for YiiBooster looks like this:

'booster' => array(
    'class' => 'path.alias.to.booster.components.Booster',
),

You should place this snippet inside the "components" section of Yii config.

Proper specification of path alias to the Bootstrap component file is the only crucial part of the config.

Important You cannot change the name of the component, it has to be booster. We are sorry for this but bear with it for now.

Note This is absolutely minimal configuration, all property will be set to defaults. You can see the full list of configuration parameters for Bootstrap component in the Basic Features section.

Lastly, YiiBooster should be initialized, to properly register all assets like the Twitter Bootstrap itself. You have two options here.

Preload the component

Most brute approach is to load the Booster component each time the application loads. Just include it inside the 'preload' section of Yii config:

'preload' => array(
    ... probably other preloaded components ...
    'booster'
),

Note This approach can lead to troubles in console commands and in JSON-only AJAX endpoints, as Booster publishes its assets when it's being loaded.

Use the custom Yii filter

You can use the "filter" feature of Yii controllers, to enable YiiBooster only on controllers and actions you really need it.

There is a BoosterFilter class made specifically for this purpose. You need to add the filters method to controller in which you want restricted usage of YiiBooster. Like this:

public function filters() {
    return array(
        ... probably other filter specifications ...
        array('path.alias.to.booster.filters.BoosterFilter - delete')
    );
}

.filters.BoosterFilter part is mandatory (it's the path to subdirectory inside YiiBooster root).

Now go either to documentation about basic built-in features or directly to widgets library, to check out what you can do now utilizing full power of YiiBooster.

Learn about basic features Visit widgets library