PHPackages                             mwstake/mediawiki-component-alertbanners - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mwstake/mediawiki-component-alertbanners

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mwstake/mediawiki-component-alertbanners
========================================

Provides an API for showing banners above the content of a page

3.0.0(1y ago)038.6k—0.7%1[2 PRs](https://github.com/hallowelt/mwstake-mediawiki-component-alertbanners/pulls)GPL-3.0-onlyPHPCI passing

Since Jun 18Pushed 5mo ago5 watchersCompare

[ Source](https://github.com/hallowelt/mwstake-mediawiki-component-alertbanners)[ Packagist](https://packagist.org/packages/mwstake/mediawiki-component-alertbanners)[ RSS](/packages/mwstake-mediawiki-component-alertbanners/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (9)Dependencies (6)Versions (15)Used By (0)

MediaWiki Stakeholders Group - Components
-----------------------------------------

[](#mediawiki-stakeholders-group---components)

AlertBanners for MediaWiki
==========================

[](#alertbanners-for-mediawiki)

Provides an API for showing banners above the content of a page

**This code is meant to be executed within the MediaWiki application context. No standalone usage is intended.**

Compatibility
-------------

[](#compatibility)

- `3.0.x` -&gt; MediaWiki 1.43
- `2.0.x` -&gt; MediaWiki 1.39
- `2.0.x` -&gt; MediaWiki 1.35

Use in a MediaWiki extension
----------------------------

[](#use-in-a-mediawiki-extension)

Require this component in the `composer.json` of your extension:

```
{
	"require": {
		"mwstake/mediawiki-component-alertbanners": "~3"
	}
}
```

Since 2.0 explicit initialization is required. This can be achived by

- either adding `"callback": "mwsInitComponents"` to your `extension.json`/`skin.json`
- or calling `mwsInitComponents();` within you extensions/skins custom `callback` method

See also [`mwstake/mediawiki-componentloader`](https://github.com/hallowelt/mwstake-mediawiki-componentloader).

### Implement a provider

[](#implement-a-provider)

Create a class that implements `MWStake\MediaWiki\Component\AlertBanners\IAlertProvider`. For convenience you may want to derive directly from the abstract base class `MWStake\MediaWiki\Component\AlertBanners\AlertProviderBase`

### Register a provider

[](#register-a-provider)

There are two ways to register a provider:

1. Using the `mwsgAlertBannersProviderRegistry` GlobalVars configuraton
2. Using the hook `MWStakeAlertBannersRegisterProviders`

On both cases a [ObjectFactory specification](https://www.mediawiki.org/wiki/ObjectFactory) must be provided.

*Example 1: GlobalVars*

```
$GLOBALS['mwsgAlertProviderRegistry']['my-own-provider'] = [
    'class' => '\\MediaWiki\Extension\\MyExt\\MyAlertProvider',
    'services' => 'MainConfig'
];
```

*Example 2: Hookhandler*

```
$GLOBALS['wgHooks']['MWStakeAlertBannersRegisterProviders'][] = function( &$providers ) {
    $providers["my-own-provider"] = [
        'class' => '\\MediaWiki\Extension\\MyExt\\MyAlertProvider',
        'services' => 'MainConfig'
    ]
}
```

### Use in client code

[](#use-in-client-code)

Load `mwstake.component.alertbanners` ResourceLoader module.

Available methods:

- `mwstake.alerts.add( id: string, $elem: jQuery, type: string )`: Inject a alert box
- `mwstake.alerts.remove( id: string )`: Remove a alert box

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance62

Regular maintenance activity

Popularity29

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~134 days

Recently: every ~224 days

Total

12

Last Release

368d ago

Major Versions

1.0.x-dev → 2.0.02022-02-07

2.0.x-dev → 3.0.02025-07-02

### Community

Maintainers

![](https://www.gravatar.com/avatar/e39dfe9d3120de240053c4283e905254e8774d3278da25ad79974a8742c55192?d=identicon)[osnard](/maintainers/osnard)

![](https://www.gravatar.com/avatar/161c38b5448b71865cf0652b6974ed489dd3683b5d6e1814973cea6cb66c8f1d?d=identicon)[dsavuljesku](/maintainers/dsavuljesku)

---

Top Contributors

[![HamishSlater](https://avatars.githubusercontent.com/u/26261210?v=4)](https://github.com/HamishSlater "HamishSlater (8 commits)")[![osnard](https://avatars.githubusercontent.com/u/1201528?v=4)](https://github.com/osnard "osnard (6 commits)")[![it-spiderman](https://avatars.githubusercontent.com/u/13665198?v=4)](https://github.com/it-spiderman "it-spiderman (2 commits)")

### Embed Badge

![Health badge](/badges/mwstake-mediawiki-component-alertbanners/health.svg)

```
[![Health](https://phpackages.com/badges/mwstake-mediawiki-component-alertbanners/health.svg)](https://phpackages.com/packages/mwstake-mediawiki-component-alertbanners)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
