Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A twitter bootstrap module for ZF2 (zend framework 2) based on rwoverdijk/assetmanager.

branch: master

This branch is 0 commits ahead and 0 commits behind master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 config
Octocat-spinner-32 public
Octocat-spinner-32 src
Octocat-spinner-32 view
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 Module.php
Octocat-spinner-32 README.md
Octocat-spinner-32 composer.json
README.md

SxBootstrap 1.7.1

This module is intended for usage with a default directory structure of a ZendSkeletonApplication and depends on the AssetManager module. It includes Twitter Bootstrap and allows you to build custom versions by overriding the configuration, and supplies some useful view helpers.

Warning!

Please rename your package to spoonx/sxbootstrap. It has been moved there.

Features

  • Fast
  • Customizable (variables, components, plugins)
  • Works with AssetManager
  • Plenty of ViewHelpers
  • Extendable (run your own less files from bootstrap context to share mixins and variables)
  • Compatible, and tested with twitter bootstrap 2.1, 2.2 and 2.3+
  • Can use lessphp

Installation

  1. Add the requirement to your composer.json file by either...

    • ... Adding it through the command line,

      ./composer.phar require spoonx/sxbootstrap
      # When asked for a version, type: "1.*"
      
    • or, adding it manually to your composer.json file and then running ./composer.phar install to install the dependencies

      {
          "require": {
              "spoonx/sxbootstrap": "1.*"
          }
      }
      
  2. Enable AssetManager and SxBootstrap in your application.config.php file.

  3. Install less...

    a) Via NPM/Node.js (recommended method):

    Install npm/node.js. Instructions can be found here.

    To Install lessc, open up your command line, and navigate to your project (cd /path/to/my/project). Once you get there, run the following command: npm install less . (including the dot). This will install less in a new directory named node_modules, enabling us to find it. If you're stubborn, and wish to install less somewhere else, Check out the wiki at "how to configure the filter to get it working (bottom of the page)"

    b) Via lessphp (please only use if absolutely necessary as lessphp is not yet complete):

    Add the requirement to your composer.json file

       {
           "require": {
               "leafo/lessphp": "0.*"
           }
       }
    

    Then add the following config to your application's module.config.php:

       'twitter_bootstrap' => array(
           'use_lessphp' => true,
       ),
    
  4. Configure the filter to get it working. (This only applies to you if your using node.js and the binary is not in /usr/bin/node, or your node paths are not the default, so you've ignored my advice in step 3a.)

  5. Take a look at the wiki for examples and other information to get started. Specifically the part on how to configure the filter to get it working (bottom of the page)

Usage

I'm not going into detail here, as you can find all of the information in the wiki. But to test if things are working you can simply call the view helper in your layout (before outputting headscript/headlink!):

<?php $this->sxBootstrap(); ?>

Refresh the page and see if it downloaded the required files. Please realize that this module will take up to a second (depending on your server's performance) to load every time, so please enable caching of some sort (read about it here, the FilePath cache is recommended).

Questions / support

If you're having trouble with the module there are a couple of resources that might be of help.

Todo

There's still a lot of work to be done on this module. For now it provides really useful functionalities and it's already useful.

  • Include other components as view helpers
  • Add unit tests
Something went wrong with that request. Please try again.