Release status: stable
|Description||Boilerplate code ready to be substituted to create a new extension with the latest standards and structure in place.|
|License||GNU General Public License 2.0 or later|
|Translate the BoilerPlate extension if it is available at translatewiki.net|
|Check usage and version matrix.|
The BoilerPlate extension is a blank extension template. It doesn't really do anything on its own, but provides boilerplate code for an actual MediaWiki extension. It also implements MediaWiki's preferred test automation and continuous integration (see that section below).
You should base your own code on the BoilerPlate extension, but for more in-depth comments and learning you should go and examine the Example extension.
To use it, enter the following commands to make a clean directory of just the BoilerPlate source code without the Git meta-data and other examples. (Substitute your extension's name for MyExtension.)
cd extensions git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/BoilerPlate.git cp -R BoilerPlate ./MyExtension
Then in MyExtension:
- rename BoilerPlate files to MyExtension.
BoilerPlatevariable names, preserving case (i.e. boilerPlate -> myExtension).
extension.jsonwith your name.
Test automation and continuous integration
If you want to install this dummy extension on your wiki to see if it works or troubleshoot problems with your adaptation.
- Download and place the file(s) in a directory called
- Add the following code at the bottom of your LocalSettings.php:
wfLoadExtension( 'BoilerPlate' );
- Visit Special:HelloWorld to verify the extension is working.
- Follow the steps in its README to install testing dependencies, then run npm test and composer test.
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Earlier MediaWiki releases
If you want your extension to be compatible with earlier MediaWiki releases, consult the source code of release branches of the Example extension.
- Extension:Example is based off this extension with additional documentation. Use the Example extension as a place to read and understand; Use the BoilerPlate extension when starting fresh on a new project.
- Manual:Developing extensions
- A cookiecutter template for MediaWiki extensions
- MWStew generates extension boilerplate files based on various parameters you give it.