A twitter bootstrap module for ZF2 (zend framework 2) based on rwoverdijk/assetmanager
This module supplies view helpers to make it easy to work with twitter bootstrap. Optionally, this module also allows you to build, cache, modify and extend twitter bootstrap using the AssetManager module.
Support for bootstrap 3.0 is under active development. You can help and test by checking out the 3.0.0 branch.
Add the requirement to your composer.json file
./composer.phar require spoonx/sxbootstrap # When asked for a version, type: "2.*"
Installation Font Awesome
Add the dependency to your composer.json file:
./composer.phar require fortawesome/font-awesome # When asked for a version, type: "3.*"
Enable the use of Font Awesome by adding the following in
<?php return array( 'twitter_bootstrap' => array( 'use_font_awesome' => true, ), );
Add the dependencies to your composer.less file:
./composer.phar require rwoverdijk/assetmanager twbs/bootstrap # When asked for a version, type: "1.*" for assetmanager and "2.*" for bootstrap.
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 (
- Once you get there, run the following command:
npm install less .(including the dot).
b) Via lessphp (Advised against):
Add the requirement
./composer.phar require leafo/lessphp # When asked for a version, type: "0.*"
Then add the following config to your application's module.config.php:
'twitter_bootstrap' => array( 'use_lessphp' => true, ),
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.)
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)
The renderer has a lot of advantages.
- Allows easy customization
- Allows you to extend (use mixins and variables in your own less files!)
- Prevents having to manually manage assets
- Allows toggling components, and plugins to include (minimizing file size by not included what you do not need).
- And more.
- Simple awesome forms
- NEW Optional Font Awesome integration
- NEW Add load paths
- NEW Add custom components
- Customizable (variables, components, plugins)
- Works with AssetManager
- Plenty of ViewHelpers
- Extendable (run your own less files from bootstrap context to share mixins and variables)
- Tested with twitter bootstrap 2.3+ (older versions will probably work, too)
- You can optionally use lessphp (not recommended)
Check out the
config/sxbootstrap.local.php.dist file in vendor/spoonx/sxbootstrap/config for the configuration options, and info.
Also, please check out the wiki.
If you're having trouble with the module there are a couple of resources that might be of help.