CINXE.COM

Manual:Extension registration - MediaWiki

<!DOCTYPE html> <html class="client-nojs vector-feature-language-in-header-disabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref--excluded vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-disabled skin-theme-clientpref-day vector-toc-available" lang="en" dir="ltr"> <head> <meta charset="UTF-8"> <title>Manual:Extension registration - MediaWiki</title> <script>(function(){var className="client-js vector-feature-language-in-header-disabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref--excluded vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-disabled skin-theme-clientpref-day vector-toc-available";var cookie=document.cookie.match(/(?:^|; )mediawikiwikimwclientpreferences=([^;]+)/);if(cookie){cookie[1].split('%2C').forEach(function(pref){className=className.replace(new RegExp('(^| )'+pref.replace(/-clientpref-\w+$|[^\w-]+/g,'')+'-clientpref-\\w+( |$)'),'$1'+pref+'$2');});}document.documentElement.className=className;}());RLCONF={"wgBreakFrames":false,"wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""], "wgDefaultDateFormat":"dmy","wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgRequestId":"0fecab8f-559e-4436-a8be-e03653da29bc","wgCanonicalNamespace":"Manual","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":100,"wgPageName":"Manual:Extension_registration","wgTitle":"Extension registration","wgCurRevisionId":6612183,"wgRevisionId":6612183,"wgArticleId":354329,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["Extension registration","Extension creation"],"wgPageViewLanguage":"en","wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgRelevantPageName":"Manual:Extension_registration","wgRelevantArticleId":354329,"wgIsProbablyEditable":false,"wgRelevantPageIsProbablyEditable":false,"wgRestrictionEdit":["autoconfirmed"],"wgRestrictionMove":["autoconfirmed"],"wgNoticeProject":"mediawiki","wgCiteReferencePreviewsActive":true, "wgMediaViewerOnClick":true,"wgMediaViewerEnabledByDefault":true,"wgVisualEditor":{"pageLanguageCode":"en","pageLanguageDir":"ltr","pageVariantFallbacks":"en"},"wgMFDisplayWikibaseDescriptions":{"search":true,"watchlist":true,"tagline":false,"nearby":true},"wgWMESchemaEditAttemptStepOversample":false,"wgWMEPageLength":20000,"wgInternalRedirectTargetUrl":"/wiki/Manual:Extension_registration","wgTranslatePageTranslation":"source","wgCentralAuthMobileDomain":false,"wgEditSubmitButtonLabelPublish":true,"wgULSPosition":"personal","wgULSisCompactLinksEnabled":true,"wgVector2022LanguageInHeader":false,"wgULSisLanguageSelectorEmpty":false,"wgCheckUserClientHintsHeadersJsApi":["brands","architecture","bitness","fullVersionList","mobile","model","platform","platformVersion"]};RLSTATE={"ext.globalCssJs.user.styles":"ready","site.styles":"ready","user.styles":"ready","ext.globalCssJs.user":"ready","user":"ready","user.options":"loading","ext.translate.tag.languages":"ready","ext.pygments":"ready", "ext.cite.styles":"ready","skins.vector.search.codex.styles":"ready","skins.vector.styles":"ready","skins.vector.icons":"ready","ext.translate.edit.documentation.styles":"ready","ext.translate":"ready","ext.wikimediamessages.styles":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready","ext.uls.pt":"ready","wikibase.client.init":"ready","ext.wikimediaBadges":"ready"};RLPAGEMODULES=["mediawiki.action.view.redirect","ext.pygments.view","ext.cite.ux-enhancements","site","mediawiki.page.ready","mediawiki.toc","skins.vector.js","ext.centralNotice.geoIP","ext.centralNotice.startUp","ext.translate.pagetranslation.uls","ext.urlShortener.toolbar","ext.centralauth.centralautologin","ext.visualEditor.desktopArticleTarget.init","ext.visualEditor.targetLoader","ext.echo.centralauth","ext.eventLogging","ext.wikimediaEvents","ext.navigationTiming","ext.uls.compactlinks","ext.uls.interface","ext.checkUser.clientHints"];</script> <script>(RLQ=window.RLQ||[]).push(function(){mw.loader.impl(function(){return["user.options@12s5i",function($,jQuery,require,module){mw.user.tokens.set({"patrolToken":"+\\","watchToken":"+\\","csrfToken":"+\\"}); }];});});</script> <link rel="stylesheet" href="/w/load.php?lang=en&amp;modules=ext.cite.styles%7Cext.pygments%2Ctranslate%2CwikimediaBadges%7Cext.translate.edit.documentation.styles%7Cext.translate.tag.languages%7Cext.uls.pt%7Cext.visualEditor.desktopArticleTarget.noscript%7Cext.wikimediamessages.styles%7Cskins.vector.icons%2Cstyles%7Cskins.vector.search.codex.styles%7Cwikibase.client.init&amp;only=styles&amp;skin=vector-2022"> <script async="" src="/w/load.php?lang=en&amp;modules=startup&amp;only=scripts&amp;raw=1&amp;skin=vector-2022"></script> <meta name="ResourceLoaderDynamicStyles" content=""> <link rel="stylesheet" href="/w/load.php?lang=en&amp;modules=site.styles&amp;only=styles&amp;skin=vector-2022"> <meta name="generator" content="MediaWiki 1.44.0-wmf.4"> <meta name="referrer" content="origin"> <meta name="referrer" content="origin-when-cross-origin"> <meta name="robots" content="max-image-preview:standard"> <meta name="format-detection" content="telephone=no"> <meta name="viewport" content="width=1120"> <meta property="og:site_name" content="MediaWiki"> <meta property="og:title" content="Manual:Extension registration - MediaWiki"> <meta property="og:type" content="website"> <link rel="alternate" media="only screen and (max-width: 640px)" href="//m.mediawiki.org/wiki/Manual:Extension_registration"> <link rel="apple-touch-icon" href="/static/apple-touch/mediawiki.png"> <link rel="icon" href="/static/favicon/mediawiki.ico"> <link rel="search" type="application/opensearchdescription+xml" href="/w/rest.php/v1/search" title="MediaWiki (en)"> <link rel="EditURI" type="application/rsd+xml" href="//www.mediawiki.org/w/api.php?action=rsd"> <link rel="canonical" href="https://www.mediawiki.org/wiki/Manual:Extension_registration"> <link rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/"> <link rel="alternate" type="application/atom+xml" title="MediaWiki Atom feed" href="/w/index.php?title=Special:RecentChanges&amp;feed=atom"> <link rel="dns-prefetch" href="//meta.wikimedia.org" /> <link rel="dns-prefetch" href="//login.wikimedia.org"> </head> <body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-100 ns-subject page-Manual_Extension_registration rootpage-Manual_Extension_registration skin-vector-2022 action-view"><a class="mw-jump-link" href="#bodyContent">Jump to content</a> <div class="vector-header-container"> <header class="vector-header mw-header"> <div class="vector-header-start"> <nav class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-dropdown" class="vector-dropdown vector-main-menu-dropdown vector-button-flush-left vector-button-flush-right" > <input type="checkbox" id="vector-main-menu-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-main-menu-dropdown" class="vector-dropdown-checkbox " aria-label="Main menu" > <label id="vector-main-menu-dropdown-label" for="vector-main-menu-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-menu mw-ui-icon-wikimedia-menu"></span> <span class="vector-dropdown-label-text">Main menu</span> </label> <div class="vector-dropdown-content"> <div id="vector-main-menu-unpinned-container" class="vector-unpinned-container"> <div id="vector-main-menu" class="vector-main-menu vector-pinnable-element"> <div class="vector-pinnable-header vector-main-menu-pinnable-header vector-pinnable-header-unpinned" data-feature-name="main-menu-pinned" data-pinnable-element-id="vector-main-menu" data-pinned-container-id="vector-main-menu-pinned-container" data-unpinned-container-id="vector-main-menu-unpinned-container" > <div class="vector-pinnable-header-label">Main menu</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-main-menu.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-main-menu.unpin">hide</button> </div> <div id="p-navigation" class="vector-menu mw-portlet mw-portlet-navigation" > <div class="vector-menu-heading"> Navigation </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-mainpage-description" class="mw-list-item"><a href="/wiki/MediaWiki" title="Visit the main page [z]" accesskey="z"><span>Main page</span></a></li><li id="n-mw-download" class="mw-list-item"><a href="/wiki/Download"><span>Get MediaWiki</span></a></li><li id="n-mw-extensions" class="mw-list-item"><a href="/wiki/Special:MyLanguage/Category:Extensions"><span>Get extensions</span></a></li><li id="n-blog-text" class="mw-list-item"><a href="https://techblog.wikimedia.org/"><span>Tech blog</span></a></li><li id="n-mw-contribute" class="mw-list-item"><a href="/wiki/Special:MyLanguage/How_to_contribute"><span>Contribute</span></a></li> </ul> </div> </div> <div id="p-support" class="vector-menu mw-portlet mw-portlet-support" > <div class="vector-menu-heading"> Support </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-help" class="mw-list-item"><a href="/wiki/Special:MyLanguage/Help:Contents" title="The place to find out"><span>User help</span></a></li><li id="n-mw-faq" class="mw-list-item"><a href="/wiki/Special:MyLanguage/Manual:FAQ"><span>FAQ</span></a></li><li id="n-mw-manual" class="mw-list-item"><a href="/wiki/Special:MyLanguage/Manual:Contents"><span>Technical manual</span></a></li><li id="n-mw-supportdesk" class="mw-list-item"><a href="/wiki/Project:Support_desk"><span>Support desk</span></a></li><li id="n-mw-communication" class="mw-list-item"><a href="/wiki/Special:MyLanguage/Communication"><span>Communication</span></a></li> </ul> </div> </div> <div id="p-development" class="vector-menu mw-portlet mw-portlet-development" > <div class="vector-menu-heading"> Development </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-mw-developerportal" class="mw-list-item"><a href="https://developer.wikimedia.org/"><span>Developer portal</span></a></li><li id="n-svn-statistics" class="mw-list-item"><a href="/wiki/Development_statistics"><span>Code statistics</span></a></li> </ul> </div> </div> <div id="p-mediawiki.org" class="vector-menu mw-portlet mw-portlet-mediawiki_org" > <div class="vector-menu-heading"> mediawiki.org </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-portal" class="mw-list-item"><a href="/wiki/Project:Help" title="About the project, what you can do, where to find things"><span>Community portal</span></a></li><li id="n-recentchanges" class="mw-list-item"><a href="/wiki/Special:RecentChanges" title="A list of recent changes in the wiki [r]" accesskey="r"><span>Recent changes</span></a></li><li id="n-mw-translate" class="mw-list-item"><a href="/wiki/Special:LanguageStats"><span>Translate content</span></a></li><li id="n-randompage" class="mw-list-item"><a href="/wiki/Special:Random" title="Load a random page [x]" accesskey="x"><span>Random page</span></a></li><li id="n-mw-discussion" class="mw-list-item"><a href="/wiki/Project:Village_Pump"><span>Village pump</span></a></li><li id="n-Sandboxlink-portlet-label" class="mw-list-item"><a href="/wiki/Project:Sandbox"><span>Sandbox</span></a></li> </ul> </div> </div> <div id="p-lang" class="vector-menu mw-portlet mw-portlet-lang" > <div class="vector-menu-heading"> In other languages </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> <div class="after-portlet after-portlet-lang"><span class="wb-langlinks-add wb-langlinks-link"><a href="https://www.wikidata.org/wiki/Special:NewItem?site=mediawikiwiki&amp;page=Manual%3AExtension+registration" title="Add interlanguage links" class="wbc-editpage">Add links</a></span></div> </div> </div> </div> </div> </div> </div> </nav> <a href="/wiki/MediaWiki" class="mw-logo"> <img class="mw-logo-icon" src="/static/images/icons/mediawikiwiki.svg" alt="" aria-hidden="true" height="50" width="50"> <span class="mw-logo-container skin-invert"> <img class="mw-logo-wordmark" alt="MediaWiki" src="/static/images/mobile/copyright/mediawikiwiki-wordmark.svg" style="width: 7.5em; height: 1.125em;"> </span> </a> </div> <div class="vector-header-end"> <div id="p-search" role="search" class="vector-search-box-vue vector-search-box-collapses vector-search-box-show-thumbnail vector-search-box-auto-expand-width vector-search-box"> <a href="/wiki/Special:Search" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only search-toggle" title="Search MediaWiki [f]" accesskey="f"><span class="vector-icon mw-ui-icon-search mw-ui-icon-wikimedia-search"></span> <span>Search</span> </a> <div class="vector-typeahead-search-container"> <div class="cdx-typeahead-search cdx-typeahead-search--show-thumbnail cdx-typeahead-search--auto-expand-width"> <form action="/w/index.php" id="searchform" class="cdx-search-input cdx-search-input--has-end-button"> <div id="simpleSearch" class="cdx-search-input__input-wrapper" data-search-loc="header-moved"> <div class="cdx-text-input cdx-text-input--has-start-icon"> <input class="cdx-text-input__input" type="search" name="search" placeholder="Search MediaWiki" aria-label="Search MediaWiki" autocapitalize="sentences" title="Search MediaWiki [f]" accesskey="f" id="searchInput" > <span class="cdx-text-input__icon cdx-text-input__start-icon"></span> </div> <input type="hidden" name="title" value="Special:Search"> </div> <button class="cdx-button cdx-search-input__end-button">Search</button> </form> </div> </div> </div> <nav class="vector-user-links vector-user-links-wide" aria-label="Personal tools"> <div class="vector-user-links-main"> <div id="p-vector-user-menu-preferences" class="vector-menu mw-portlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-uls" class="mw-list-item active user-links-collapsible-item"><a data-mw="interface" href="#" class="uls-trigger cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet"><span class="vector-icon mw-ui-icon-wikimedia-language mw-ui-icon-wikimedia-wikimedia-language"></span> <span>English</span></a> </li> </ul> </div> </div> <div id="p-vector-user-menu-userpage" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-dropdown" class="vector-dropdown " title="Change the appearance of the page&#039;s font size, width, and color" > <input type="checkbox" id="vector-appearance-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-appearance-dropdown" class="vector-dropdown-checkbox " aria-label="Appearance" > <label id="vector-appearance-dropdown-label" for="vector-appearance-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-appearance mw-ui-icon-wikimedia-appearance"></span> <span class="vector-dropdown-label-text">Appearance</span> </label> <div class="vector-dropdown-content"> <div id="vector-appearance-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <div id="p-vector-user-menu-notifications" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-overflow" class="vector-menu mw-portlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="https://donate.wikimedia.org/?utm_source=donate&amp;utm_medium=sidebar&amp;utm_campaign=spontaneous&amp;uselang=en" class=""><span>Donate</span></a> </li> <li id="pt-createaccount-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:CreateAccount&amp;returnto=Manual%3AExtension+registration" title="You are encouraged to create an account and log in; however, it is not mandatory" class=""><span>Create account</span></a> </li> <li id="pt-login-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:UserLogin&amp;returnto=Manual%3AExtension+registration" title="You are encouraged to log in; however, it is not mandatory [o]" accesskey="o" class=""><span>Log in</span></a> </li> </ul> </div> </div> </div> <div id="vector-user-links-dropdown" class="vector-dropdown vector-user-menu vector-button-flush-right vector-user-menu-logged-out" title="More options" > <input type="checkbox" id="vector-user-links-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-user-links-dropdown" class="vector-dropdown-checkbox " aria-label="Personal tools" > <label id="vector-user-links-dropdown-label" for="vector-user-links-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-ellipsis mw-ui-icon-wikimedia-ellipsis"></span> <span class="vector-dropdown-label-text">Personal tools</span> </label> <div class="vector-dropdown-content"> <div id="p-personal" class="vector-menu mw-portlet mw-portlet-personal user-links-collapsible-item" title="User menu" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport" class="user-links-collapsible-item mw-list-item"><a href="https://donate.wikimedia.org/?utm_source=donate&amp;utm_medium=sidebar&amp;utm_campaign=spontaneous&amp;uselang=en"><span>Donate</span></a></li><li id="pt-createaccount" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:CreateAccount&amp;returnto=Manual%3AExtension+registration" title="You are encouraged to create an account and log in; however, it is not mandatory"><span class="vector-icon mw-ui-icon-userAdd mw-ui-icon-wikimedia-userAdd"></span> <span>Create account</span></a></li><li id="pt-login" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:UserLogin&amp;returnto=Manual%3AExtension+registration" title="You are encouraged to log in; however, it is not mandatory [o]" accesskey="o"><span class="vector-icon mw-ui-icon-logIn mw-ui-icon-wikimedia-logIn"></span> <span>Log in</span></a></li> </ul> </div> </div> <div id="p-user-menu-anon-editor" class="vector-menu mw-portlet mw-portlet-user-menu-anon-editor" > <div class="vector-menu-heading"> Pages for logged out editors <a href="/wiki/Help:Introduction" aria-label="Learn more about editing"><span>learn more</span></a> </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-anoncontribs" class="mw-list-item"><a href="/wiki/Special:MyContributions" title="A list of edits made from this IP address [y]" accesskey="y"><span>Contributions</span></a></li><li id="pt-anontalk" class="mw-list-item"><a href="/wiki/Special:MyTalk" title="Discussion about edits from this IP address [n]" accesskey="n"><span>Talk</span></a></li> </ul> </div> </div> </div> </div> </nav> </div> </header> </div> <div class="mw-page-container"> <div class="mw-page-container-inner"> <div class="vector-sitenotice-container"> <div id="siteNotice"><!-- CentralNotice --></div> </div> <div class="vector-column-start"> <div class="vector-main-menu-container"> <div id="mw-navigation"> <nav id="mw-panel" class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-pinned-container" class="vector-pinned-container"> </div> </nav> </div> </div> <div class="vector-sticky-pinned-container"> <nav id="mw-panel-toc" aria-label="Contents" data-event-name="ui.sidebar-toc" class="mw-table-of-contents-container vector-toc-landmark"> <div id="vector-toc-pinned-container" class="vector-pinned-container"> <div id="vector-toc" class="vector-toc vector-pinnable-element"> <div class="vector-pinnable-header vector-toc-pinnable-header vector-pinnable-header-pinned" data-feature-name="toc-pinned" data-pinnable-element-id="vector-toc" > <h2 class="vector-pinnable-header-label">Contents</h2> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-toc.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-toc.unpin">hide</button> </div> <ul class="vector-toc-contents" id="mw-panel-toc-list"> <li id="toc-mw-content-text" class="vector-toc-list-item vector-toc-level-1"> <a href="#" class="vector-toc-link"> <div class="vector-toc-text">Beginning</div> </a> </li> <li id="toc-Features" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Features"> <div class="vector-toc-text"> <span class="vector-toc-numb">1</span> <span>Features</span> </div> </a> <button aria-controls="toc-Features-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Features subsection</span> </button> <ul id="toc-Features-sublist" class="vector-toc-list"> <li id="toc-Attributes" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Attributes"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.1</span> <span>Attributes</span> </div> </a> <ul id="toc-Attributes-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Requirements_(dependencies)" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Requirements_(dependencies)"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.2</span> <span>Requirements (dependencies)</span> </div> </a> <ul id="toc-Requirements_(dependencies)-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Check_if_an_extension_is_loaded_without_actually_requiring_it" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Check_if_an_extension_is_loaded_without_actually_requiring_it"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.3</span> <span>Check if an extension is loaded without actually requiring it</span> </div> </a> <ul id="toc-Check_if_an_extension_is_loaded_without_actually_requiring_it-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Configs_(Your_extension/skins_settings)" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Configs_(Your_extension/skins_settings)"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.4</span> <span>Configs (Your extension/skins settings)</span> </div> </a> <ul id="toc-Configs_(Your_extension/skins_settings)-sublist" class="vector-toc-list"> <li id="toc-value" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#value"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.4.1</span> <span>value</span> </div> </a> <ul id="toc-value-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-path" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#path"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.4.2</span> <span>path</span> </div> </a> <ul id="toc-path-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-description" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#description"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.4.3</span> <span>description</span> </div> </a> <ul id="toc-description-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-descriptionmsg" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#descriptionmsg"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.4.4</span> <span>descriptionmsg</span> </div> </a> <ul id="toc-descriptionmsg-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-public_/_private" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#public_/_private"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.4.5</span> <span>public / private</span> </div> </a> <ul id="toc-public_/_private-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Outlook" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Outlook"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.4.6</span> <span>Outlook</span> </div> </a> <ul id="toc-Outlook-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Unit_tests_auto-discovery" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Unit_tests_auto-discovery"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.5</span> <span>Unit tests auto-discovery</span> </div> </a> <ul id="toc-Unit_tests_auto-discovery-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Tracking_categories" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Tracking_categories"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.6</span> <span>Tracking categories</span> </div> </a> <ul id="toc-Tracking_categories-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Customizing_registration" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Customizing_registration"> <div class="vector-toc-text"> <span class="vector-toc-numb">2</span> <span>Customizing registration</span> </div> </a> <ul id="toc-Customizing_registration-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Also_composer.json" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Also_composer.json"> <div class="vector-toc-text"> <span class="vector-toc-numb">3</span> <span>Also composer.json</span> </div> </a> <ul id="toc-Also_composer.json-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Code_stewardship" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Code_stewardship"> <div class="vector-toc-text"> <span class="vector-toc-numb">4</span> <span>Code stewardship</span> </div> </a> <ul id="toc-Code_stewardship-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-See_also" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#See_also"> <div class="vector-toc-text"> <span class="vector-toc-numb">5</span> <span>See also</span> </div> </a> <button aria-controls="toc-See_also-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle See also subsection</span> </button> <ul id="toc-See_also-sublist" class="vector-toc-list"> <li id="toc-Documentation" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Documentation"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.1</span> <span>Documentation</span> </div> </a> <ul id="toc-Documentation-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Feedback" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Feedback"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.2</span> <span>Feedback</span> </div> </a> <ul id="toc-Feedback-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-References" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#References"> <div class="vector-toc-text"> <span class="vector-toc-numb">6</span> <span>References</span> </div> </a> <ul id="toc-References-sublist" class="vector-toc-list"> </ul> </li> </ul> </div> </div> </nav> </div> </div> <div class="mw-content-container"> <main id="content" class="mw-body"> <header class="mw-body-header vector-page-titlebar"> <nav aria-label="Contents" class="vector-toc-landmark"> <div id="vector-page-titlebar-toc" class="vector-dropdown vector-page-titlebar-toc vector-button-flush-left" > <input type="checkbox" id="vector-page-titlebar-toc-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-titlebar-toc" class="vector-dropdown-checkbox " aria-label="Toggle the table of contents" > <label id="vector-page-titlebar-toc-label" for="vector-page-titlebar-toc-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-listBullet mw-ui-icon-wikimedia-listBullet"></span> <span class="vector-dropdown-label-text">Toggle the table of contents</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-titlebar-toc-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <h1 id="firstHeading" class="firstHeading mw-first-heading"><span class="mw-page-title-namespace">Manual</span><span class="mw-page-title-separator">:</span><span class="mw-page-title-main">Extension registration</span></h1> <div class="mw-indicators"> </div> </header> <div class="vector-page-toolbar"> <div class="vector-page-toolbar-container"> <div id="left-navigation"> <nav aria-label="Namespaces"> <div id="p-associated-pages" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-associated-pages" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-nstab-manual" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Manual:Extension_registration" title="View the subject page [c]" accesskey="c"><span>Manual</span></a></li><li id="ca-talk" class="vector-tab-noicon mw-list-item"><a href="/wiki/Manual_talk:Extension_registration" rel="discussion" title="Discussion about the content page [t]" accesskey="t"><span>Discussion</span></a></li> </ul> </div> </div> <div id="vector-variants-dropdown" class="vector-dropdown emptyPortlet" > <input type="checkbox" id="vector-variants-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-variants-dropdown" class="vector-dropdown-checkbox " aria-label="Change language variant" > <label id="vector-variants-dropdown-label" for="vector-variants-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">English</span> </label> <div class="vector-dropdown-content"> <div id="p-variants" class="vector-menu mw-portlet mw-portlet-variants emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> </div> </div> </nav> </div> <div id="right-navigation" class="vector-collapsible"> <nav aria-label="Views"> <div id="p-views" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-views" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-view" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Manual:Extension_registration"><span>Read</span></a></li><li id="ca-viewsource" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Manual:Extension_registration&amp;action=edit" title="This page is protected.&#10;You can view its source [e]" accesskey="e"><span>View source</span></a></li><li id="ca-history" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Manual:Extension_registration&amp;action=history" title="Past revisions of this page [h]" accesskey="h"><span>View history</span></a></li> </ul> </div> </div> </nav> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-dropdown" class="vector-dropdown vector-page-tools-dropdown" > <input type="checkbox" id="vector-page-tools-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-tools-dropdown" class="vector-dropdown-checkbox " aria-label="Tools" > <label id="vector-page-tools-dropdown-label" for="vector-page-tools-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">Tools</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-tools-unpinned-container" class="vector-unpinned-container"> <div id="vector-page-tools" class="vector-page-tools vector-pinnable-element"> <div class="vector-pinnable-header vector-page-tools-pinnable-header vector-pinnable-header-unpinned" data-feature-name="page-tools-pinned" data-pinnable-element-id="vector-page-tools" data-pinned-container-id="vector-page-tools-pinned-container" data-unpinned-container-id="vector-page-tools-unpinned-container" > <div class="vector-pinnable-header-label">Tools</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-page-tools.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-page-tools.unpin">hide</button> </div> <div id="p-cactions" class="vector-menu mw-portlet mw-portlet-cactions emptyPortlet vector-has-collapsible-items" title="More options" > <div class="vector-menu-heading"> Actions </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-more-view" class="selected vector-more-collapsible-item mw-list-item"><a href="/wiki/Manual:Extension_registration"><span>Read</span></a></li><li id="ca-more-viewsource" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Manual:Extension_registration&amp;action=edit"><span>View source</span></a></li><li id="ca-more-history" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Manual:Extension_registration&amp;action=history"><span>View history</span></a></li> </ul> </div> </div> <div id="p-tb" class="vector-menu mw-portlet mw-portlet-tb" > <div class="vector-menu-heading"> General </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-whatlinkshere" class="mw-list-item"><a href="/wiki/Special:WhatLinksHere/Manual:Extension_registration" title="A list of all wiki pages that link here [j]" accesskey="j"><span>What links here</span></a></li><li id="t-recentchangeslinked" class="mw-list-item"><a href="/wiki/Special:RecentChangesLinked/Manual:Extension_registration" rel="nofollow" title="Recent changes in pages linked from this page [k]" accesskey="k"><span>Related changes</span></a></li><li id="t-upload" class="mw-list-item"><a href="//commons.wikimedia.org/wiki/Special:UploadWizard" title="Upload files [u]" accesskey="u"><span>Upload file</span></a></li><li id="t-specialpages" class="mw-list-item"><a href="/wiki/Special:SpecialPages" title="A list of all special pages [q]" accesskey="q"><span>Special pages</span></a></li><li id="t-permalink" class="mw-list-item"><a href="/w/index.php?title=Manual:Extension_registration&amp;oldid=6612183" title="Permanent link to this revision of this page"><span>Permanent link</span></a></li><li id="t-info" class="mw-list-item"><a href="/w/index.php?title=Manual:Extension_registration&amp;action=info" title="More information about this page"><span>Page information</span></a></li><li id="t-cite" class="mw-list-item"><a href="/w/index.php?title=Special:CiteThisPage&amp;page=Manual%3AExtension_registration&amp;id=6612183&amp;wpFormIdentifier=titleform" title="Information on how to cite this page"><span>Cite this page</span></a></li><li id="t-urlshortener" class="mw-list-item"><a href="/w/index.php?title=Special:UrlShortener&amp;url=https%3A%2F%2Fwww.mediawiki.org%2Fwiki%2FManual%3AExtension_registration"><span>Get shortened URL</span></a></li><li id="t-urlshortener-qrcode" class="mw-list-item"><a href="/w/index.php?title=Special:QrCode&amp;url=https%3A%2F%2Fwww.mediawiki.org%2Fwiki%2FManual%3AExtension_registration"><span>Download QR code</span></a></li> </ul> </div> </div> <div id="p-coll-print_export" class="vector-menu mw-portlet mw-portlet-coll-print_export" > <div class="vector-menu-heading"> Print/export </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="coll-create_a_book" class="mw-list-item"><a href="/w/index.php?title=Special:Book&amp;bookcmd=book_creator&amp;referer=Manual%3AExtension+registration"><span>Create a book</span></a></li><li id="coll-download-as-rl" class="mw-list-item"><a href="/w/index.php?title=Special:DownloadAsPdf&amp;page=Manual%3AExtension_registration&amp;action=show-download-screen"><span>Download as PDF</span></a></li><li id="t-print" class="mw-list-item"><a href="/w/index.php?title=Manual:Extension_registration&amp;printable=yes" title="Printable version of this page [p]" accesskey="p"><span>Printable version</span></a></li> </ul> </div> </div> <div id="p-wikibase-otherprojects" class="vector-menu mw-portlet mw-portlet-wikibase-otherprojects emptyPortlet" > <div class="vector-menu-heading"> In other projects </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> </div> </div> </div> </div> </nav> </div> </div> </div> <div class="vector-column-end"> <div class="vector-sticky-pinned-container"> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-pinned-container" class="vector-pinned-container"> </div> </nav> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-pinned-container" class="vector-pinned-container"> <div id="vector-appearance" class="vector-appearance vector-pinnable-element"> <div class="vector-pinnable-header vector-appearance-pinnable-header vector-pinnable-header-pinned" data-feature-name="appearance-pinned" data-pinnable-element-id="vector-appearance" data-pinned-container-id="vector-appearance-pinned-container" data-unpinned-container-id="vector-appearance-unpinned-container" > <div class="vector-pinnable-header-label">Appearance</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-appearance.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-appearance.unpin">hide</button> </div> </div> </div> </nav> </div> </div> <div id="bodyContent" class="vector-body" aria-labelledby="firstHeading" data-mw-ve-target-container> <div class="vector-body-before-content"> <div id="siteSub" class="noprint">From mediawiki.org</div> </div> <div id="contentSub"><div id="mw-content-subtitle"></div></div> <div id="mw-content-text" class="mw-body-content"><div class="mw-pt-translate-header noprint nomobile" dir="ltr" lang="en"><a href="/w/index.php?title=Special:Translate&amp;group=page-Manual%3AExtension+registration&amp;action=page&amp;filter=&amp;action_source=translate_page" title="Special:Translate">Translate this page</a></div><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><div class="mw-pt-languages noprint navigation-not-searchable" lang="en" dir="ltr"><div class="mw-pt-languages-label">Languages:</div><ul class="mw-pt-languages-list"><li><a href="/wiki/Manual:Extension_registration/id" class="mw-pt-progress mw-pt-progress--low" title="Manual:Pendaftaran perpanjangan (6% translated)" lang="id" dir="ltr">Bahasa Indonesia</a></li> <li><a href="/wiki/Manual:Extension_registration/de" class="mw-pt-progress mw-pt-progress--high" title="Manual:Erweiterungsregistrierung (74% translated)" lang="de" dir="ltr">Deutsch</a></li> <li><span class="mw-pt-languages-ui mw-pt-languages-selected mw-pt-progress mw-pt-progress--complete" lang="en" dir="ltr">English</span></li> <li><a href="/wiki/Manual:Extension_registration/ha" class="mw-pt-progress mw-pt-progress--low" title="Manual:Extension registration/ha (1% translated)" lang="ha" dir="ltr">Hausa</a></li> <li><a href="/wiki/Manual:Extension_registration/dtp" class="mw-pt-progress mw-pt-progress--low" title="Manual:Extension registration/dtp (1% translated)" lang="dtp" dir="ltr">Kadazandusun</a></li> <li><a href="/wiki/Manual:Extension_registration/tr" class="mw-pt-progress mw-pt-progress--med" title="Manual:Uzantı kayıtı (15% translated)" lang="tr" dir="ltr">Türkçe</a></li> <li><a href="/wiki/Manual:Extension_registration/es" class="mw-pt-progress mw-pt-progress--low" title="Manual:Registro de extensiones (4% translated)" lang="es" dir="ltr">español</a></li> <li><a href="/wiki/Manual:Extension_registration/fr" class="mw-pt-progress mw-pt-progress--high" title="Manuel:Enregistrement des extensions (97% translated)" lang="fr" dir="ltr">français</a></li> <li><a href="/wiki/Manual:Extension_registration/pl" class="mw-pt-progress mw-pt-progress--low" title="Manual:Extension registration/pl (3% translated)" lang="pl" dir="ltr">polski</a></li> <li><a href="/wiki/Manual:Extension_registration/pt" class="mw-pt-progress mw-pt-progress--med" title="Manual:Registo de Extensão (21% translated)" lang="pt" dir="ltr">português</a></li> <li><a href="/wiki/Manual:Extension_registration/pt-br" class="mw-pt-progress mw-pt-progress--low" title="Manual:Registro de extensão (2% translated)" lang="pt-BR" dir="ltr">português do Brasil</a></li> <li><a href="/wiki/Manual:Extension_registration/cs" class="mw-pt-progress mw-pt-progress--complete" title="Příručka:Registrace rozšíření (100% translated)" lang="cs" dir="ltr">čeština</a></li> <li><a href="/wiki/Manual:Extension_registration/ru" class="mw-pt-progress mw-pt-progress--low" title="Руководство:Регистрация расширений (12% translated)" lang="ru" dir="ltr">русский</a></li> <li><a href="/wiki/Manual:Extension_registration/gu" class="mw-pt-progress mw-pt-progress--low" title="Manual:Extension registration/gu (1% translated)" lang="gu" dir="ltr">ગુજરાતી</a></li> <li><a href="/wiki/Manual:Extension_registration/zh" class="mw-pt-progress mw-pt-progress--med" title="Manual:扩展注册 (15% translated)" lang="zh" dir="ltr">中文</a></li> <li><a href="/wiki/Manual:Extension_registration/ja" class="mw-pt-progress mw-pt-progress--low" title="Manual:拡張機能の登録 (9% translated)" lang="ja" dir="ltr">日本語</a></li></ul></div> <style data-mw-deduplicate="TemplateStyles:r6353907">.mw-parser-output .hatnote{font-style:italic;padding-bottom:0.4em;margin-bottom:0.4em;border-bottom:1px solid #ccc}.mw-parser-output .hatnote.no-border{border-bottom:none}</style><div role="note" class="hatnote"><i>extension.json redirects here. For a list of specifications, go to <a href="/wiki/Special:MyLanguage/Manual:Extension.json/Schema" title="Special:MyLanguage/Manual:Extension.json/Schema">Extension.json/Schema</a> directly.</i></div> <style data-mw-deduplicate="TemplateStyles:r4199130">.mw-parser-output .mw-version{border:1px solid #72777d;font-size:80%;line-height:1.2;border-collapse:collapse}.mw-parser-output .mw-version-ltr{float:right;margin:0 0 .5em .5em;text-align:right}.mw-parser-output .mw-version-rtl{float:left;margin:0 .5em .5em 0;text-align:left}.mw-parser-output .mw-version td{padding:.1em .3em}.mw-parser-output .mw-version-versionbox{border:5px solid #00af89;text-align:center}.mw-parser-output .mw-version-versionnumber{font-weight:bold;font-size:180%}.mw-parser-output .mw-version-version .mw-version-versionbox{border-color:#c8ccd1}.mw-parser-output .mw-version.mw-version-version2 .mw-version-versionbox{border-top-color:#c8ccd1;border-right-color:#c8ccd1;border-left-color:#c8ccd1}.mw-parser-output .mw-version-version-unsupported .mw-version-versionbox{border-color:#d33}.mw-parser-output .mw-version.mw-version-version2-unsupported .mw-version-versionbox{border-top-color:#d33;border-right-color:#d33;border-left-color:#d33}.mw-parser-output .mw-version-version-legacy .mw-version-versionbox{border-color:#f93}.mw-parser-output .mw-version.mw-version-version2-legacy .mw-version-versionbox{border-top-color:#f93;border-right-color:#f93;border-left-color:#f93}.mw-parser-output .mw-version-version-stable .mw-version-versionbox,.mw-parser-output .mw-version.mw-version.mw-version-and-later .mw-version-versionbox{border-color:#00af89}.mw-parser-output .mw-version.mw-version-version2-stable .mw-version-versionbox{border-top-color:#00af89;border-right-color:#00af89;border-left-color:#00af89}.mw-parser-output .mw-version-version-future .mw-version-versionbox{border-color:#8080c0}.mw-parser-output .mw-version.mw-version-version2-future .mw-version-versionbox{border-top-color:#8080c0;border-right-color:#8080c0;border-left-color:#8080c0}.mw-parser-output .mw-version-version-alpha .mw-version-versionbox{border-style:dotted}</style> <table class="mw-version mw-version-ltr mw-version-version mw-version-version-unsupported mw-version-and-later"><tbody><tr> <td>MediaWiki version:</td> <td class="mw-version-versionbox" title="The latest stable version is 1.42"><div class="mw-version-versionnumber"><small>&#8805;</small> 1.25</div><small><a href="https://gerrit.wikimedia.org/r/166705" class="extiw" title="gerrit:166705">Gerrit change 166705</a></small></td> </tr></tbody></table> <p><b>Extension registration</b> is the mechanism that MediaWiki uses to load <a href="/wiki/Special:MyLanguage/Manual:Extensions" title="Special:MyLanguage/Manual:Extensions">extensions</a> and <a href="/wiki/Special:MyLanguage/Manual:Skins" title="Special:MyLanguage/Manual:Skins">skins</a>. You put <a href="/wiki/Special:MyLanguage/Manual:Extension.json/Schema" title="Special:MyLanguage/Manual:Extension.json/Schema">configuration data</a> in a file named <code>extension.json</code> or <code>skin.json</code> in the root directory of your extension or skin, and MediaWiki uses this to register extensions and skins. </p><p>If you were looking for documentation on <i>installing</i> extensions instead, <a href="/wiki/Special:MyLanguage/Manual:Extensions/Installation_and_upgrade" title="Special:MyLanguage/Manual:Extensions/Installation and upgrade">see this guide</a>. </p> <meta property="mw:PageProp/toc" /> <div class="mw-heading mw-heading2"><h2 id="Features">Features</h2></div> <div class="mw-heading mw-heading3"><h3 id="Attributes">Attributes</h3></div> <p>"Attributes" let you register something, such as a module, with another extension. For instance, the VisualEditor (VE) extension offers the <code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nv">$wgVisualEditorPluginModules</span></code> hook, which other extensions can use to register a module with VE. If the Math extension were to register a module with VE, it would have something like the following in its <code>extension.json</code>: </p> <table class="wikitable"> <tbody><tr> <th>manifest version 2 </th> <th>manifest version 1 </th></tr> <tr> <td>The <code>attributes</code> node needs to be an object with the extension name as key and an object of attribute/value pairs as the value. Be aware that the key in the subobject must not contain the extension name! <div class="mw-highlight mw-highlight-lang-json mw-content-ltr" dir="ltr"><pre><span></span><span class="p">{</span> <span class="w"> </span><span class="nt">&quot;attributes&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">&quot;VisualEditor&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">&quot;PluginModules&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[</span> <span class="w"> </span><span class="s2">&quot;ext.math.visualEditor&quot;</span> <span class="w"> </span><span class="p">]</span> <span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="p">},</span> <span class="w"> </span><span class="nt">&quot;manifest_version&quot;</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span> <span class="p">}</span> </pre></div> </td> <td>Manifest version 1 does not have a separate section for <code>attributes</code>: <div class="mw-highlight mw-highlight-lang-json mw-content-ltr" dir="ltr"><pre><span></span><span class="p">{</span> <span class="w"> </span><span class="nt">&quot;VisualEditorPluginModules&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[</span> <span class="w"> </span><span class="s2">&quot;ext.math.visualEditor&quot;</span> <span class="w"> </span><span class="p">]</span> <span class="p">}</span> </pre></div> </td></tr></tbody></table> <p>If VisualEditor wants to access this attribute, it would use: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="nx">ExtensionRegistry</span><span class="o">::</span><span class="na">getInstance</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">getAttribute</span><span class="p">(</span> <span class="s1">&#39;VisualEditorPluginModules&#39;</span> <span class="p">);</span> </pre></div> <p><br /> </p> <div class="mw-heading mw-heading3"><h3 id="Requirements_(dependencies)"><span id="Requirements_.28dependencies.29"></span>Requirements (dependencies)</h3></div> <p>Extension registration has a <code>requires</code> section, which acts similar to <a href="/wiki/Special:MyLanguage/Composer" title="Special:MyLanguage/Composer">Composer</a>'s <code>require</code> section. It allows an extension developer to specify several requirements for the extension, such as a specific MediaWiki version (or greater/less than) or another extension/skin. For example, to add a dependency on a MediaWiki version that is greater than 1.26.0, you can add the following code to <code>extension.json</code>: <sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">&#91;</span>1<span class="cite-bracket">&#93;</span></a></sup> </p> <div class="mw-highlight mw-highlight-lang-json mw-content-ltr" dir="ltr"><pre><span></span><span class="p">{</span> <span class="w"> </span><span class="nt">&quot;requires&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">&quot;MediaWiki&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;&gt;= 1.26.0&quot;</span> <span class="w"> </span><span class="p">}</span> <span class="p">}</span> </pre></div> <p>The key of the <code>requires</code> object is the name of the dependency (prior to MediaWiki 1.29.0 only <code>MediaWiki</code> was supported), the value is a valid version constraint (the format has to match the one <a rel="nofollow" class="external text" href="https://getcomposer.org/doc/articles/versions.md">used by composer</a>). </p><p>In MediaWiki 1.29.0 and above you can also add dependencies on skins and other extensions like so: </p> <div class="mw-highlight mw-highlight-lang-json mw-content-ltr" dir="ltr"><pre><span></span><span class="p">{</span> <span class="w"> </span><span class="nt">&quot;requires&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">&quot;MediaWiki&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;&gt;= 1.29.0&quot;</span><span class="p">,</span> <span class="w"> </span><span class="nt">&quot;extensions&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">&quot;ExampleExtension&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;*&quot;</span> <span class="w"> </span><span class="p">},</span> <span class="w"> </span><span class="nt">&quot;skins&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">&quot;ExampleSkin&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;*&quot;</span> <span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="p">}</span> <span class="p">}</span> </pre></div> <style data-mw-deduplicate="TemplateStyles:r6651107">.mw-parser-output .note{background-position:left 7px top 50%;padding:0.5em 0.5em 0.5em 40px;margin:0.5em 0;overflow:hidden;background-color:#f8f9fa;color:#333;background-repeat:no-repeat;border:1px solid #ddd}.mw-parser-output .note-inline{display:inline-block;vertical-align:middle}.mw-parser-output .note-info{background-color:#eaf3ff;color:#333;background-image:url("https://upload.wikimedia.org/wikipedia/commons/e/ec/OOjs_UI_icon_information-progressive.svg");background-size:25px;border-color:#a3caff;padding-left:40px;min-height:25px}.mw-parser-output .note-reminder{background-color:#fff9ea;color:#333;background-image:url("https://upload.wikimedia.org/wikipedia/commons/a/a8/OOjs_UI_icon_lightbulb-yellow.svg");background-size:25px;border-color:#fc3;min-height:25px}.mw-parser-output .note-warn{background-color:#fff9ea;color:#333;background-image:url("https://upload.wikimedia.org/wikipedia/commons/3/3b/OOjs_UI_icon_alert-warning.svg");background-size:25px;border-color:#fc3;min-height:25px}.mw-parser-output .note-error{background-color:#fee7e6;color:#333;background-image:url("https://upload.wikimedia.org/wikipedia/commons/b/bf/OOjs_UI_icon_notice-destructive.svg");background-size:25px;border-color:#c33;min-height:25px}@media screen{html.skin-theme-clientpref-night .mw-parser-output .note{background-color:transparent;color:inherit}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .note{background-color:transparent;color:inherit}}</style><div role="note" class="note note-info"> <ul><li>The extensions and skins specified here must also use the extension registrations system described on this page for this to work.</li> <li>The string added to specify the extension or skin must be identical to the string specified in the "name" field of the respective "extension.json" or "skin.json" file.</li> <li>For extensions using Wikimedia <a href="/wiki/Special:MyLanguage/Continuous_integration" title="Special:MyLanguage/Continuous integration">continuous integration</a>, dependencies also need to be added to <a href="https://gerrit.wikimedia.org/g/integration/config/%2B/HEAD/zuul/parameter_functions.py" class="extiw" title="git:integration/config/+/HEAD/zuul/parameter functions.py">zuul/parameter_functions.py</a></li></ul></div> <p>In MediaWiki 1.33.0(?!??) and above you can also add dependencies on PHP like so: </p> <div class="mw-highlight mw-highlight-lang-json mw-content-ltr" dir="ltr"><pre><span></span><span class="p">{</span> <span class="w"> </span><span class="nt">&quot;requires&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">&quot;MediaWiki&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;&gt;= 1.33.0&quot;</span><span class="p">,</span> <span class="w"> </span><span class="nt">&quot;platform&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">&quot;php&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;&gt;= 7.0.3&quot;</span> <span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="p">}</span> <span class="p">}</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="Check_if_an_extension_is_loaded_without_actually_requiring_it">Check if an extension is loaded without actually requiring it</h3></div> <p>Many extensions may provide features that work only if another extension is loaded too, without really needing this feature for the core extension function to work. As an example: If extension B is loaded, extension A can provide a real WYSIWYG editor, otherwise it will use a simple textarea. Extension A can profit from extension B (if it is loaded), but doesn't require it to be loaded to work properly. For this, you generally check, if the extension is loaded, rather than adding it as a <i>hard</i> dependency. </p><p>To implement a standardized way of checking, if an extension is loaded or not (without the need of extra work in an extension that is a soft-dependency in another one), extension registration can be used. It implements an <code>isLoaded</code> method, which returns a simple boolean, if the extension is loaded or not (the extension needs to be loaded with extension registration for this to work). Example: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="k">if</span> <span class="p">(</span> <span class="nx">ExtensionRegistry</span><span class="o">::</span><span class="na">getInstance</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">isLoaded</span><span class="p">(</span> <span class="s1">&#39;ExtensionB&#39;</span> <span class="p">)</span> <span class="p">)</span> <span class="p">{</span> <span class="c1">// do things only, if extension B is loaded</span> <span class="p">}</span> </pre></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r4199130"> <table class="mw-version mw-version-ltr mw-version-version mw-version-version-unsupported mw-version-and-later"><tbody><tr> <td>MediaWiki version:</td> <td class="mw-version-versionbox" title="The latest stable version is 1.42"><div class="mw-version-versionnumber"><small>&#8805;</small> 1.32</div><small><a href="https://gerrit.wikimedia.org/r/455752" class="extiw" title="gerrit:455752">Gerrit change 455752</a></small></td> </tr></tbody></table> <p>Since <a href="/wiki/Special:MyLanguage/MediaWiki_1.32" title="Special:MyLanguage/MediaWiki 1.32">MediaWiki 1.32</a> it's also possible to check if an extension is loaded and satisfies a given composer version constraint: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="k">if</span> <span class="p">(</span> <span class="nx">ExtensionRegistry</span><span class="o">::</span><span class="na">getInstance</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">isLoaded</span><span class="p">(</span> <span class="s1">&#39;ExtensionB&#39;</span><span class="p">,</span> <span class="s1">&#39;&gt;=1.2&#39;</span> <span class="p">)</span> <span class="p">)</span> <span class="p">{</span> <span class="c1">// do things only, if extension B is loaded and has a version of 1.2 or greater.</span> <span class="p">}</span> </pre></div> <p>If you would like to check if a specific version of an extension is loaded in earlier versions of MediaWiki, information like that can be extracted with the <code>getAllThings</code> method, which returns credit information for all loaded extensions. Example: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="nv">$bVersion</span> <span class="o">=</span> <span class="nx">ExtensionRegistry</span><span class="o">::</span><span class="na">getInstance</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">getAllThings</span><span class="p">()[</span><span class="s1">&#39;ExtensionB&#39;</span><span class="p">][</span><span class="s1">&#39;version&#39;</span><span class="p">]</span> <span class="o">??</span> <span class="k">null</span><span class="p">;</span> <span class="k">if</span> <span class="p">(</span> <span class="nv">$bVersion</span> <span class="o">!==</span> <span class="k">null</span> <span class="o">&amp;&amp;</span> <span class="nb">version_compare</span><span class="p">(</span> <span class="nv">$bVersion</span><span class="p">,</span> <span class="s1">&#39;2.1.0&#39;</span><span class="p">,</span> <span class="s1">&#39;&gt;=&#39;</span> <span class="p">)</span> <span class="p">)</span> <span class="p">{</span> <span class="c1">// do things only, if extension B is loaded and has a version number greater than or equal to 2.1.0</span> <span class="p">}</span> </pre></div> <p>Alternatively, if the extension B defines a special constant meant for this purpose during loading, it is possible to check, if it is defined: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="k">if</span> <span class="p">(</span> <span class="nb">defined</span><span class="p">(</span> <span class="s1">&#39;ExtensionBVersion&#39;</span> <span class="p">)</span> <span class="p">)</span> <span class="p">{</span> <span class="c1">// You could also check for a version, if the constant holds the version</span> <span class="c1">// do things only, if extension B is loaded</span> <span class="p">}</span> </pre></div> <p>A more brittle way, that should be avoided is to check if a specific class of extension B exists or not, e.g. using this code: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="k">if</span> <span class="p">(</span> <span class="nb">class_exists</span><span class="p">(</span> <span class="s1">&#39;ExtensionBHooks&#39;</span> <span class="p">)</span> <span class="p">)</span> <span class="p">{</span> <span class="c1">// do things only, if extension B its classes exist</span> <span class="p">}</span> </pre></div> <p>This might break if the extension exists in the file system but is not loaded, e.g. if composer was used for autoloading. If the class was renamed or ceases to exist (e.g. because it is not package public) this will also break. </p><p>In general it is preferred to share code via composer components instead of extensions. If the classes of an extension only need to exist, but the extension does not need to be configured nor loaded, for what you want to do, that is a strong indicator that that code should be split off into a composer component you should depend on instead. </p> <div class="mw-heading mw-heading3"><h3 id="Configs_(Your_extension/skins_settings)"><span id="Configs_.28Your_extension.2Fskins_settings.29"></span>Configs (Your extension/skins settings)</h3></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r6353907"><div role="note" class="hatnote mw-tpl-seealso">See also&#58; <a href="/wiki/Special:MyLanguage/Manual:Configuration_for_developers" title="Special:MyLanguage/Manual:Configuration for developers">Manual:Configuration for developers</a></div> <p><br /> </p> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r6353907"><div role="note" class="hatnote mw-tpl-seealso">See also&#58; <a href="/wiki/Special:MyLanguage/Manual:Extension.json/Schema#config" title="Special:MyLanguage/Manual:Extension.json/Schema">Manual:Extension.json/Schema#config</a></div> <p>By default, <code>extension.json</code> assumes that your config settings start with a "wg" prefix. </p><p>If that's not the case, you can override the prefix by using a special key: </p> <div class="mw-highlight mw-highlight-lang-json mw-content-ltr" dir="ltr"><pre><span></span><span class="p">{</span> <span class="w"> </span><span class="nt">&quot;config&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">&quot;_prefix&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;eg&quot;</span><span class="p">,</span> <span class="w"> </span><span class="nt">&quot;MyExtSetting&quot;</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span> <span class="w"> </span><span class="p">}</span> <span class="p">}</span> </pre></div> <p>That would use a prefix of "eg", and set the global variable <code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nv">$egMyExtSetting</span></code> to true. </p><p>Starting with manifest version 2, the configuration section of extension registration provides a lot more features and allows you to describe your configuration options with much more detail. Instead of having a single key -&gt; value store for your configuration options, you can also add the following information. </p><p>The general structure of the <code>config</code> changes slightly to the following, more object-oriented version: </p> <div class="mw-highlight mw-highlight-lang-json mw-content-ltr" dir="ltr"><pre><span></span><span class="p">{</span> <span class="w"> </span><span class="nt">&quot;config_prefix&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;eg&quot;</span><span class="p">,</span> <span class="w"> </span><span class="nt">&quot;config&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">&quot;MyExtSetting&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">&quot;value&quot;</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span> <span class="w"> </span><span class="nt">&quot;path&quot;</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span> <span class="w"> </span><span class="nt">&quot;description&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;The description for the configuration&quot;</span><span class="p">,</span> <span class="w"> </span><span class="nt">&quot;descriptionmsg&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;myextension-config-myextsetting&quot;</span><span class="p">,</span> <span class="w"> </span><span class="nt">&quot;public&quot;</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span> <span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="p">},</span> <span class="w"> </span><span class="nt">&quot;manifest_version&quot;</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span> <span class="p">}</span> </pre></div> <div class="mw-heading mw-heading4"><h4 id="value">value</h4></div> <p>The value of the configuration moved to this place. This is the only required key for a configuration object. </p> <div class="mw-heading mw-heading4"><h4 id="path">path</h4></div> <p>The boolean value of the <code>path</code> key identifies, if the value of the configuration option should be interpreted as a filesystem path, relative to the extension directory root. E.g., if the value of the configuration is <code>myFile.png</code> and the <code>path</code> is true, the actual value will be <code>/path/to/the/wiki/extensions/MyExtension/myFile.png</code>. </p> <div class="mw-heading mw-heading4"><h4 id="description">description</h4></div> <p>The <code>description</code> key for a configuration option can hold a non-localized string, which can be used to explain the configuration option to other developers or the users (system administrators) of your extension. It may also be used as tooltip text on the parameters section of the extension infobox on the MediaWiki.org extension description page. The value of the description key is usually not exposed to the frontend of the wiki, however, take a look to the outlook for more information how this feature could be used in the future! </p> <div class="mw-heading mw-heading4"><h4 id="descriptionmsg">descriptionmsg</h4></div> <p>There's also the possibility to add a message key of MediaWiki's internal localisation system as a description (<code>descriptionmsg</code>), which, in the future, will be used to expose the description in the frontend of the MediaWiki installation. </p> <div class="mw-heading mw-heading4"><h4 id="public_/_private"><span id="public_.2F_private"></span>public / private</h4></div> <p>This option is a boolean, which defaults to <code>false</code>, which means, that the configuration option and the value is marked as "private". This value is not used anywhere at the moment, take a look to the outlook to find out more about this option. </p> <div class="mw-heading mw-heading4"><h4 id="Outlook">Outlook</h4></div> <style data-mw-deduplicate="TemplateStyles:r6853958">.mw-parser-output .tpl-tracked{background-color:var(--background-color-interactive,#EAECF0);color:var(--color-base,#202122);border:1px solid #72777D;border-radius:2px;font-size:85%;margin-bottom:1em;padding:0.5em;text-align:center;width:12em}.mw-parser-output .tpl-tracked.float-left{float:left;clear:left;margin-right:1em}.mw-parser-output .tpl-tracked.float-right{float:right;clear:right;margin-left:1em}.mw-parser-output .tpl-tracked .status{color:black;font-weight:bold;text-transform:uppercase}.mw-parser-output .tpl-tracked .status.resolved{color:green}@media screen{html.skin-theme-clientpref-night .mw-parser-output .tpl-tracked .status:not(.resolved){color:white}}</style><div class="tpl-tracked plainlinks mw-trackedTemplate float-right">Tracked in <a href="https://phabricator.wikimedia.org/" class="extiw" title="phabricator:">Phabricator</a><br /><b><a href="https://phabricator.wikimedia.org/T155155" class="extiw" title="phabricator:T155155"><span class="trakfab-T155155">Task T155155</span></a></b><br /><span class="status"></span></div> <p>The mentioned changes above are also preparation steps for an improved configuration management in MediaWiki. The above changes allow us to, e.g., expose the configuration options of extensions in the MediaWiki UI. For this, the localised description message (<code>descriptionmsg</code> and <code>description</code>) and the indication, if the configuration option should be exposed or not (<code>public</code>) is needed. </p> <div class="mw-heading mw-heading3"><h3 id="Unit_tests_auto-discovery">Unit tests auto-discovery</h3></div> <p>MediaWiki allows any extension to <a href="/wiki/Special:MyLanguage/Manual:PHP_unit_testing/Writing_unit_tests_for_extensions" title="Special:MyLanguage/Manual:PHP unit testing/Writing unit tests for extensions">register phpunit tests</a>. Without extension registration, you would need to register a hook handler for the <a href="/wiki/Special:MyLanguage/Manual:Hooks/UnitTestsList" title="Special:MyLanguage/Manual:Hooks/UnitTestsList">UnitTestsList</a><span style="display:none"><a href="/wiki/Manual:Hooks/UnitTestsList" title="Manual:Hooks/UnitTestsList"> </a></span> hook, which would look something like: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="k">public</span> <span class="k">static</span> <span class="k">function</span> <span class="nf">onUnitTestsList</span><span class="p">(</span> <span class="k">array</span> <span class="o">&amp;</span><span class="nv">$paths</span> <span class="p">)</span> <span class="p">{</span> <span class="nv">$paths</span><span class="p">[]</span> <span class="o">=</span> <span class="no">__DIR__</span> <span class="o">.</span> <span class="s1">&#39;/tests/phpunit/&#39;</span><span class="p">;</span> <span class="p">}</span> </pre></div> <p>(as described on the manual page). However, this code looks the same for a lot of extensions, so you could call it unnecessary code duplication. If your extension uses extension registration and your phpunit tests are located in the <code>tests/phpunit/</code> subdirectory of your extension, the phpunit wrapper of MediaWiki will autodiscover the unit tests with the help of extension registration. Therefore, you don't need to register the hook anymore and you don't need to specify, that your unit tests are saved in the default directory. </p> <div class="mw-heading mw-heading3"><h3 id="Tracking_categories">Tracking categories</h3></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r6353907"><div role="note" class="hatnote mw-tpl-seealso">See also&#58; <a href="/wiki/Help:Tracking_categories" title="Help:Tracking categories">Help:Tracking categories</a> and <a href="/wiki/Manual:Extension.json/Schema#TrackingCategories" title="Manual:Extension.json/Schema">Manual:Extension.json/Schema#TrackingCategories</a></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r4199130"> <table class="mw-version mw-version-ltr mw-version-version mw-version-version-unsupported mw-version-and-later"><tbody><tr> <td>MediaWiki version:</td> <td class="mw-version-versionbox" title="The latest stable version is 1.42"><div class="mw-version-versionnumber"><small>&#8805;</small> 1.25</div></td> </tr></tbody></table> <p>Since <a href="/wiki/Special:MyLanguage/MediaWiki_1.25" title="Special:MyLanguage/MediaWiki 1.25">MediaWiki 1.25</a>, any categories that an extension wants listed at <a href="/wiki/Special:TrackingCategories" title="Special:TrackingCategories">Special:TrackingCategories</a> must be registered in <code>extension.json</code>: </p> <div class="mw-highlight mw-highlight-lang-json mw-content-ltr" dir="ltr"><pre><span></span><span class="p">{</span> <span class="w"> </span><span class="nt">&quot;TrackingCategories&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[</span> <span class="w"> </span><span class="s2">&quot;myextension-tracking-category&quot;</span> <span class="w"> </span><span class="p">]</span> <span class="p">}</span> </pre></div> <p><code>myextension-tracking-category</code> is a <a href="/wiki/Special:MyLanguage/Help:System_message" title="Special:MyLanguage/Help:System message">system message</a> which holds the category name. The extension adds it to pages by calling <code>Parser::addTrackingCategory()</code>. </p><p><br /> </p> <div class="mw-heading mw-heading2"><h2 id="Customizing_registration">Customizing registration</h2></div> <dl><dd><i>See <a href="/wiki/Special:MyLanguage/Manual:Extension.json/Schema#callback" title="Special:MyLanguage/Manual:Extension.json/Schema">Manual:Extension.json/Schema#callback</a>.</i></dd></dl> <div class="mw-heading mw-heading2"><h2 id="Also_composer.json">Also composer.json</h2></div> <p>If an extension or skin has library dependencies, it may have a <code>composer.json</code> file as well, see <a href="/wiki/Special:MyLanguage/Manual:Composer.json_best_practices" title="Special:MyLanguage/Manual:Composer.json best practices">Manual:Composer.json best practices</a><span style="display:none"><a href="/wiki/Manual:Composer.json_best_practices" title="Manual:Composer.json best practices"> </a></span>. Use the <code>load_composer_autoloader</code> field to make MediaWiki use Composer's autoloading when appropriate. </p><p>Some metadata fields overlap between <code>extension.json</code> and <code>composer.json</code> (discussed in <a href="https://phabricator.wikimedia.org/T89456" class="extiw" title="phabricator:T89456">task T89456</a>), including&#160;: </p> <ul><li><code>url</code> and <code>homepage</code></li> <li><code>license-name</code> and <code>license</code></li></ul> <div class="mw-heading mw-heading2"><h2 id="Code_stewardship">Code stewardship</h2></div> <ul><li>Maintained by <span style="color:#72777d">Unknown or Unassigned<sup>[&#8205;<a href="/wiki/Special:MyLanguage/Developers/Maintainers" title="Special:MyLanguage/Developers/Maintainers">Maintainers page</a>]</sup></span>.</li> <li>Issue tracker: <a class="external text" href="https://phabricator.wikimedia.org/tag/mediawiki-configuration/">Phabricator MediaWiki-Configuration</a> (<a class="external text" href="https://phabricator.wikimedia.org/maniphest/task/edit/form/1/?projects=mediawiki-configuration">Report an issue</a>)</li></ul> <div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div> <div class="mw-heading mw-heading3"><h3 id="Documentation">Documentation</h3></div> <ul><li><a href="/wiki/Special:MyLanguage/Manual:Extension.json/Schema" title="Special:MyLanguage/Manual:Extension.json/Schema">Manual:Extension.json/Schema</a><span style="display:none"><a href="/wiki/Manual:Extension.json/Schema" title="Manual:Extension.json/Schema"> </a></span> <ul><li><code><a href="https://phabricator.wikimedia.org/diffusion/MW/browse/master/docs/extension.schema.v2.json" class="extiw" title="phab:diffusion/MW/browse/master/docs/extension.schema.v2.json">docs/extension.schema.v2.json</a></code> is the schema for <code>extension.json</code> (and skin.json).</li></ul></li> <li><a href="/wiki/Special:MyLanguage/Manual:Extension_registration/Limitations" title="Special:MyLanguage/Manual:Extension registration/Limitations">Known limitations</a><span style="display:none"><a href="/wiki/Manual:Extension_registration/Limitations" title="Manual:Extension registration/Limitations"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Manual:Extension_registration/Architecture" title="Special:MyLanguage/Manual:Extension registration/Architecture">Overview of architecture</a><span style="display:none"><a href="/wiki/Manual:Extension_registration/Architecture" title="Manual:Extension registration/Architecture"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Manual:Extension_registration/Migration" title="Special:MyLanguage/Manual:Extension registration/Migration">Migration guide</a><span style="display:none"><a href="/wiki/Manual:Extension_registration/Migration" title="Manual:Extension registration/Migration"> </a></span> - some recommendations on updating older extensions</li></ul> <div class="mw-heading mw-heading3"><h3 id="Feedback">Feedback</h3></div> <ul><li>Report bugs against the <a href="https://phabricator.wikimedia.org/tag/mediawiki-configuration/" class="extiw" title="phab:tag/mediawiki-configuration/">MediaWiki-Configuration</a> project.</li> <li><a href="/wiki/Requests_for_comment/Extension_registration" title="Requests for comment/Extension registration">RfC</a> about implementing extension registration</li></ul> <div class="mw-heading mw-heading2"><h2 id="References">References</h2></div> <div class="reflist" style="list-style-type: decimal;"> <div class="mw-references-wrap"><ol class="references"> <li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text"><a rel="nofollow" class="external free" href="https://github.com/wikimedia/mediawiki/blob/78091899db2315916502421fdd2972f1d73237b3/docs/extension.schema.json#L273-L282">https://github.com/wikimedia/mediawiki/blob/78091899db2315916502421fdd2972f1d73237b3/docs/extension.schema.json#L273-L282</a></span> </li> </ol></div></div> <style data-mw-deduplicate="TemplateStyles:r6651103">.mw-parser-output .nmbox{background:#f8f9fa;border:1px solid #AAA;box-sizing:border-box;margin:2px 0;padding:0}.mw-parser-output .nmbox *{box-sizing:border-box}.mw-parser-output .nmbox-header{background:#eaecf0;padding:4px 0.5em;font-weight:bold;text-align:center;white-space:nowrap}.mw-parser-output .nmbox .mbox-image{display:inline-block;padding-right:1em}.mw-parser-output .nmbox-text{border-top:1px solid #AAA;width:100%;padding:4px 0.5em}@media screen and (min-width:768px){.mw-parser-output .nmbox-header{display:table-cell;border-right:1px solid #AAA;width:1%}.mw-parser-output .nmbox-text{border-top:none;display:table-cell}}@media screen{html.skin-theme-clientpref-night .mw-parser-output .nmbox-header,html.skin-theme-clientpref-night .mw-parser-output .nmbox{background:transparent;color:inherit}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .nmbox-header,html.skin-theme-clientpref-os .mw-parser-output .nmbox{background:transparent;color:inherit}}</style> <div class="nmbox noprint mw-content-ltr"><div class="nmbox-header"><b><a href="/wiki/Special:MyLanguage/Manual:Extensions" title="Special:MyLanguage/Manual:Extensions">Extensions</a><span style="display:none"><a href="/wiki/Manual:Extensions" title="Manual:Extensions"> </a></span></b>: </div> <div class="nmbox-text mbox-text"><style data-mw-deduplicate="TemplateStyles:r6387430">.mw-parser-output .hlist dl,.mw-parser-output .hlist ol,.mw-parser-output .hlist ul{margin:0;padding:0}.mw-parser-output .hlist dd,.mw-parser-output .hlist dt,.mw-parser-output .hlist li{margin:0;display:inline}.mw-parser-output .hlist dl dl,.mw-parser-output .hlist dl ol,.mw-parser-output .hlist dl ul,.mw-parser-output .hlist ol dl,.mw-parser-output .hlist ol ol,.mw-parser-output .hlist ol ul,.mw-parser-output .hlist ul dl,.mw-parser-output .hlist ul ol,.mw-parser-output .hlist ul ul{display:inline}.mw-parser-output .hlist .mw-empty-li,.mw-parser-output .hlist .mw-empty-elt{display:none}.mw-parser-output .hlist dt:after{content:": "}.mw-parser-output .hlist dd:after,.mw-parser-output .hlist li:after{content:" · ";font-weight:bold}.mw-parser-output .hlist dd:last-child:after,.mw-parser-output .hlist dt:last-child:after,.mw-parser-output .hlist li:last-child:after{content:none}.mw-parser-output .hlist dd dd:first-child:before,.mw-parser-output .hlist dd dt:first-child:before,.mw-parser-output .hlist dd li:first-child:before,.mw-parser-output .hlist dt dd:first-child:before,.mw-parser-output .hlist dt dt:first-child:before,.mw-parser-output .hlist dt li:first-child:before,.mw-parser-output .hlist li dd:first-child:before,.mw-parser-output .hlist li dt:first-child:before,.mw-parser-output .hlist li li:first-child:before{content:" (";font-weight:normal}.mw-parser-output .hlist dd dd:last-child:after,.mw-parser-output .hlist dd dt:last-child:after,.mw-parser-output .hlist dd li:last-child:after,.mw-parser-output .hlist dt dd:last-child:after,.mw-parser-output .hlist dt dt:last-child:after,.mw-parser-output .hlist dt li:last-child:after,.mw-parser-output .hlist li dd:last-child:after,.mw-parser-output .hlist li dt:last-child:after,.mw-parser-output .hlist li li:last-child:after{content:")";font-weight:normal}.mw-parser-output .hlist ol{counter-reset:listitem}.mw-parser-output .hlist ol>li{counter-increment:listitem}.mw-parser-output .hlist ol>li:before{content:" "counter(listitem)"\a0 "}.mw-parser-output .hlist dd ol>li:first-child:before,.mw-parser-output .hlist dt ol>li:first-child:before,.mw-parser-output .hlist li ol>li:first-child:before{content:" ("counter(listitem)"\a0 "}</style><div class="hlist"> <ul><li><a href="/wiki/Special:MyLanguage/Category:Extensions" title="Special:MyLanguage/Category:Extensions">Category</a><span style="display:none"><a href="/wiki/Category:Extensions" title="Category:Extensions"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Category:All_extensions" title="Special:MyLanguage/Category:All extensions">All</a><span style="display:none"><a href="/wiki/Category:All_extensions" title="Category:All extensions"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Extension_requests" title="Special:MyLanguage/Extension requests">Requests</a><span style="display:none"><a href="/wiki/Extension_requests" title="Extension requests"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Manual:Tag_extensions" title="Special:MyLanguage/Manual:Tag extensions">Tag extensions</a><span style="display:none"><a href="/wiki/Manual:Tag_extensions" title="Manual:Tag extensions"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Extensions_FAQ" title="Special:MyLanguage/Extensions FAQ">Extensions FAQ</a><span style="display:none"><a href="/wiki/Extensions_FAQ" title="Extensions FAQ"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Manual:Extensions/Installation_and_upgrade" title="Special:MyLanguage/Manual:Extensions/Installation and upgrade">Installation and upgrade</a><span style="display:none"><a href="/wiki/Manual:Extensions/Installation_and_upgrade" title="Manual:Extensions/Installation and upgrade"> </a></span></li> <li><b><a href="/wiki/Special:MyLanguage/Manual:Extension_registration" title="Special:MyLanguage/Manual:Extension registration">Registration</a></b><span style="display:none"><a class="mw-selflink selflink"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Category:Extension_hooks" title="Special:MyLanguage/Category:Extension hooks">List of extension hooks</a><span style="display:none"><a href="/wiki/Category:Extension_hooks" title="Category:Extension hooks"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Extension_default_namespaces" title="Special:MyLanguage/Extension default namespaces">Extension default namespaces</a><span style="display:none"><a href="/wiki/Extension_default_namespaces" title="Extension default namespaces"> </a></span></li></ul> </div></div> </div> <!-- NewPP limit report Parsed by mw‐api‐int.codfw.main‐648bd44df8‐28vpc Cached time: 20241115074432 Cache expiry: 2592000 Reduced expiry: false Complications: [show‐toc] CPU time usage: 0.467 seconds Real time usage: 0.595 seconds Preprocessor visited node count: 2652/1000000 Post‐expand include size: 24614/2097152 bytes Template argument size: 11965/2097152 bytes Highest expansion depth: 20/100 Expensive parser function count: 32/500 Unstrip recursion depth: 0/20 Unstrip post‐expand size: 29145/5000000 bytes Lua time usage: 0.047/10.000 seconds Lua memory usage: 1649268/52428800 bytes Number of Wikibase entities loaded: 0/400 --> <!-- Transclusion expansion time report (%,ms,calls,template) 100.00% 338.789 1 -total 27.48% 93.107 18 Template:Ll 25.05% 84.881 1 Template:Extensions 23.71% 80.337 1 Template:Nmbox 20.34% 68.911 2 Template:MW_version 19.07% 64.604 1 Template:Flatlist 18.10% 61.332 3 Template:MW_version/layout 12.65% 42.849 36 Template:Translatable 11.12% 37.662 19 Template:Pagelang 6.69% 22.671 1 Template:Component --> <!-- Saved in parser cache with key mediawikiwiki:pcache:idhash:354329-0!canonical and timestamp 20241115074432 and revision id 6612183. Rendering was triggered because: api-parse --> </div><!--esi <esi:include src="/esitest-fa8a495983347898/content" /> --><noscript><img src="https://login.wikimedia.org/wiki/Special:CentralAutoLogin/start?type=1x1" alt="" width="1" height="1" style="border: none; position: absolute;"></noscript> <div class="printfooter" data-nosnippet="">Retrieved from "<a dir="ltr" href="https://www.mediawiki.org/w/index.php?title=Manual:Extension_registration&amp;oldid=6612183">https://www.mediawiki.org/w/index.php?title=Manual:Extension_registration&amp;oldid=6612183</a>"</div></div> <div id="catlinks" class="catlinks" data-mw="interface"><div id="mw-normal-catlinks" class="mw-normal-catlinks"><a href="/wiki/Special:Categories" title="Special:Categories">Categories</a>: <ul><li><a href="/wiki/Category:Extension_registration" title="Category:Extension registration">Extension registration</a></li><li><a href="/wiki/Category:Extension_creation" title="Category:Extension creation">Extension creation</a></li></ul></div></div> </div> </main> </div> <div class="mw-footer-container"> <footer id="footer" class="mw-footer" > <ul id="footer-info"> <li id="footer-info-lastmod"> This page was last edited on 29 June 2024, at 13:56.</li> <li id="footer-info-copyright">Text is available under the <a rel="nofollow" class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-ShareAlike License</a>; additional terms may apply. Text in <a class="external text" href="https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents">the Help: namespace</a> is available under the <a rel="nofollow" class="external text" href="https://creativecommons.org/publicdomain/zero/1.0/">Creative Commons CC0 License</a>. By using this site, you agree to the <a class="external text" href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Terms_of_Use">Terms of Use</a> and <a class="external text" href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy">Privacy Policy</a>.</li> </ul> <ul id="footer-places"> <li id="footer-places-privacy"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy">Privacy policy</a></li> <li id="footer-places-about"><a href="/wiki/Project:About">About mediawiki.org</a></li> <li id="footer-places-disclaimers"><a href="/wiki/Project:General_disclaimer">Disclaimers</a></li> <li id="footer-places-wm-codeofconduct"><a href="https://www.mediawiki.org/wiki/Special:MyLanguage/Code_of_Conduct">Code of Conduct</a></li> <li id="footer-places-developers"><a href="https://developer.wikimedia.org">Developers</a></li> <li id="footer-places-statslink"><a href="https://stats.wikimedia.org/#/www.mediawiki.org">Statistics</a></li> <li id="footer-places-cookiestatement"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Cookie_statement">Cookie statement</a></li> <li id="footer-places-mobileview"><a href="//m.mediawiki.org/w/index.php?title=Manual:Extension_registration&amp;mobileaction=toggle_view_mobile" class="noprint stopMobileRedirectToggle">Mobile view</a></li> </ul> <ul id="footer-icons" class="noprint"> <li id="footer-copyrightico"><a href="https://wikimediafoundation.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/static/images/footer/wikimedia-button.svg" width="84" height="29" alt="Wikimedia Foundation" loading="lazy"></a></li> <li id="footer-poweredbyico"><a href="https://www.mediawiki.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/w/resources/assets/poweredby_mediawiki.svg" alt="Powered by MediaWiki" width="88" height="31" loading="lazy"></a></li> </ul> </footer> </div> </div> </div> <div class="vector-settings" id="p-dock-bottom"> <ul></ul> </div><script>(RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgHostname":"mw-web.codfw.main-f69cdc8f6-cdf8n","wgBackendResponseTime":124,"wgPageParseReport":{"limitreport":{"cputime":"0.467","walltime":"0.595","ppvisitednodes":{"value":2652,"limit":1000000},"postexpandincludesize":{"value":24614,"limit":2097152},"templateargumentsize":{"value":11965,"limit":2097152},"expansiondepth":{"value":20,"limit":100},"expensivefunctioncount":{"value":32,"limit":500},"unstrip-depth":{"value":0,"limit":20},"unstrip-size":{"value":29145,"limit":5000000},"entityaccesscount":{"value":0,"limit":400},"timingprofile":["100.00% 338.789 1 -total"," 27.48% 93.107 18 Template:Ll"," 25.05% 84.881 1 Template:Extensions"," 23.71% 80.337 1 Template:Nmbox"," 20.34% 68.911 2 Template:MW_version"," 19.07% 64.604 1 Template:Flatlist"," 18.10% 61.332 3 Template:MW_version/layout"," 12.65% 42.849 36 Template:Translatable"," 11.12% 37.662 19 Template:Pagelang"," 6.69% 22.671 1 Template:Component"]},"scribunto":{"limitreport-timeusage":{"value":"0.047","limit":"10.000"},"limitreport-memusage":{"value":1649268,"limit":52428800}},"cachereport":{"origin":"mw-api-int.codfw.main-648bd44df8-28vpc","timestamp":"20241115074432","ttl":2592000,"transientcontent":false}}});});</script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10