mwstake / mediawiki-component-events
Mechanism for firing events
Installs: 13 348
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 1
Open Issues: 0
Requires
- composer/installers: ~1.0|~2
- mwstake/mediawiki-componentloader: ~1
Requires (Dev)
- mediawiki/mediawiki-codesniffer: 45.0.0
- mediawiki/mediawiki-phan-config: 0.14.0
- mediawiki/minus-x: 1.1.3
- php-parallel-lint/php-console-highlighter: 1.0.0
- php-parallel-lint/php-parallel-lint: 1.4.0
- phpunit/phpunit: ^8.5
This package is auto-updated.
Last update: 2025-04-02 18:36:21 UTC
README
This component allows you to emit notification events to consumers
Compatibility
4.0.x
-> MediaWiki 1.433.0.x
-> MediaWiki 1.391.0.x
-> MediaWiki 1.35
Use in a MediaWiki extension
Require this component in the composer.json
of your extension:
{ "require": { "mwstake/mediawiki-component-events": "~4" } }
Register consumer
$GLOBALS['wgMWStakeNotificationEventConsumers'][] = [ 'class' => MyConsumer::class, 'services' => [ 'UserFactory' ] ];
Create Event
class MyEvent implements \MWStake\MediaWiki\Component\Events\INotificationEvent { .... } $event = new MyEvent( $user );
Emit Event
$notifier = MediaWikiServices::getInstance()->getService( 'MWStake.Notifier' ); $notifier->emit( $event ); // Will call MyConsumer::consume( $event )