From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png

Release status:Extension status stable

ImplementationTemplate:Extension#type Skin
DescriptionTemplate:Extension#description Provides the Twitter Bootstrap 3 web front-end framework
Author(s)Template:Extension#username Stephan Gambke (F.trotttalk)
Latest versionTemplate:Extension#version 1.2.3 (November 2017)
Compatibility policyCompatibility#mediawiki_extensions master
MediaWikiTemplate:Extension#mediawiki 1.22+
PHPTemplate:Extension#php 5.3+
Database changesTemplate:Extension#needs-updatephp No
ComposerComposer mediawiki/bootstrap
LicenseTemplate:Extension#license GNU General Public License 3.0 or later
Download see text
README on GitHub
Changelog on GitHub
Hooks usedTemplate:Extension#hook

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. YesY 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