Manual:Hooks/MediaWikiServices

From MediaWiki.org
Jump to navigation Jump to search
MediaWikiServices
Available from version 1.27.0
Called when a global MediaWikiServices instance is initialized
Define function:
public static function onMediaWikiServices( MediaWikiServices $services ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"MediaWikiServices": "MyExtensionHooks::onMediaWikiServices"
	}
}

For MediaWiki ≤1.25:

$wgHooks['MediaWikiServices'][] = 'MyExtensionHooks::onMediaWikiServices';
Called from:File(s): MediaWikiServices.php

For more information about attaching hooks, see Manual:Hooks.
For examples of extensions using this hook, see Category:MediaWikiServices extensions.

Extensions may use this to define, replace, or wrap services. However, the preferred way to define a new service is the $wgServiceWiringFiles array.

Details[edit]