Template:ExtensionInstallComposer
Appearance
From mediawiki.org
This template can be used on extension description pages, where the extension features a composer.json with a proper name and type attribute. It is based on Composer/For_extensions#Installing_extensions_that_are_not_available_from_Packagist .
- Example 1 - Version tag releases
{{ExtensionInstallComposer |MyExtension |vcs=https://github.com/wikimedia/mediawiki-extensions-MyExtension.git |packageName=mediawiki/my-extension |versionConstraint=1.0.* }}
- Result
- Add the repo url (https://github.com/wikimedia/mediawiki-extensions-MyExtension.git) as a "vcs repository" and the package name (mediawiki/my-extension) and version to the
requiresection of yourcomposer.local.json. Example:
{ "repositories":[ { "type":"vcs", "url":"https://github.com/wikimedia/mediawiki-extensions-MyExtension.git" } ], "require":{ "mediawiki/my-extension":"dev-REL1_43" } }
- Run the following command in your MediaWiki installation path
composer update --no-dev
- Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'MyExtension' );
- Yes Done Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
- Example 2 - LTS bound releases
{{ExtensionInstallComposer|MyExtension |vcs=https://github.com/wikimedia/mediawiki-extensions-MyExtension.git |packageName=mediawiki/my-extension |versionConstraint=1.0.* }}
- Result
- Add the repo url (https://github.com/wikimedia/mediawiki-extensions-MyExtension.git) as a "vcs repository" and the package name (mediawiki/my-extension) and version to the
requiresection of yourcomposer.local.json. Example:
{ "repositories":[ { "type":"vcs", "url":"https://github.com/wikimedia/mediawiki-extensions-MyExtension.git" } ], "require":{ "mediawiki/my-extension":"dev-REL1_43" } }
- Run the following command in your MediaWiki installation path
composer update --no-dev
- Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'MyExtension' );
- Yes Done Navigate to Special:Version on your wiki to verify that the extension is successfully installed.