This component allows you to emit notification events to consumers
MediaWiki 1.35
- Add
"mwstake/mediawiki-component-events": "~1"
to therequire
section of yourcomposer.json
file.
MediaWiki 1.39
- Add
"mwstake/mediawiki-component-events": "~2"
to therequire
section of yourcomposer.json
file.
$GLOBALS['wgMWStakeNotificationEventConsumers'][] = [
'class' => MyConsumer::class,
'services' => [
'UserFactory'
]
];
class MyEvent implements \MWStake\MediaWiki\Component\Events\INotificationEvent {
....
}
$event = new MyEvent( $user );
$notifier = MediaWikiServices::getInstance()->getService( 'MWStake.Notifier' );
$notifier->emit( $event );
// Will call MyConsumer::consume( $event )