From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
Crystal Clear action run.svg
Release status: stable
Implementation Skin
Description Provides the Twitter Bootstrap 3 web front-end framework
Author(s) Stephan Gambke (F.trotttalk)
Latest version 1.2.3 (November 2017)
Compatibility policy master
MediaWiki 1.22+
PHP 5.3+
Database changes No
Composer mediawiki/bootstrap
License GNU General Public License 3.0 or later
README on GitHub
Changelog on GitHub
Hooks used
Translate the Bootstrap extension if it is available at translatewiki.net
Check usage and version matrix.

The Bootstrap extension provides the Twitter Bootstrap (version 3) web front-end framework to MediaWiki. It can be activated directly or used from skins or extensions.


The Bootstrap extension requires Composer for installation. (But why!?)

  1. If not already done, install Composer.
  2. If not already done, copy composer-example.json to composer.json in your MediaWiki installation directory
  3. Run composer require "mediawiki/bootstrap:~1.0" (or php composer.phar require "mediawiki/bootstrap:~1.0" if applicable)
  4. Run composer update --no-dev
  5. Yes Done – Navigate to "Special:Version" on your wiki to verify that the extension is successfully installed.

Remark: If you are upgrading from a version of this extension installed without using Composer, before running composer you need to first

  • Remove the old extension from the extensions directory
  • Remove the require_once "$IP/extensions/Bootstrap/Bootstrap.php"; from LocalSettings.php


Use \Bootstrap\BootstrapManager::getInstance() to get the singleton managing the Bootstrap framework. You can then add modules using its methods addBootstrapModule(), addAllBootstrapModules(), and addExternalModule().

You can set LESS variables using setLessVariable() and setLessVariables().

Finally to add the Bootstrap styles and javascript to the page use $out->addModuleStyles( 'ext.bootstrap.styles' ) for styles and $out->addModules( 'ext.bootstrap.scripts' ) for scripts.

To simply enable Bootstrap styles on all pages add the following code to LocalSettings.php:

	return true;

$wgHooks['ParserAfterParse'][]=function( Parser &$parser, &$text, StripState &$stripState ){
	$parser->getOutput()->addModuleStyles( 'ext.bootstrap.styles' );
	$parser->getOutput()->addModuleScripts( 'ext.bootstrap.scripts' );
	return true;

For an example on how to include Bootstrap styles in a skin have a look at the Chameleon skin.


Comments, questions and suggestions should be sent or posted to:

See also[edit]

Directly related[edit]


  • the BootStrap extension (note the exact spelling of the name!) aims to allow for the addition of Bootstrap styling within MediaWiki articles
  • the BootStrapSkin skin makes use of the BootStrap extension
  • the Bootstrap skin is another Bootstrap based skin independent from either extension