PHPackages                             jeroen/message-reporter - 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. jeroen/message-reporter

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

jeroen/message-reporter
=======================

An interface to report and relay arbitrary messages to registered handlers, plus test doubles

1.5.0(3mo ago)015.7k1GPL-2.0-or-laterPHPPHP &gt;=8.1CI passing

Since Jan 24Pushed 2mo agoCompare

[ Source](https://github.com/JeroenDeDauw/message-reporter)[ Packagist](https://packagist.org/packages/jeroen/message-reporter)[ Docs](https://github.com/JeroenDeDauw/message-reporter)[ GitHub Sponsors](https://github.com/JeroenDeDauw)[ RSS](/packages/jeroen-message-reporter/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (5)Versions (10)Used By (0)

Message Reporter
================

[](#message-reporter)

[![CI](https://github.com/JeroenDeDauw/message-reporter/actions/workflows/ci.yml/badge.svg)](https://github.com/JeroenDeDauw/message-reporter/actions/workflows/ci.yml)[![Latest Stable Version](https://camo.githubusercontent.com/d97888a88e398e24041f80c49367c7ae7b59e5084fa6b9a161f8685def4772bc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a65726f656e2f6d6573736167652d7265706f727465722e737667)](https://camo.githubusercontent.com/d97888a88e398e24041f80c49367c7ae7b59e5084fa6b9a161f8685def4772bc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a65726f656e2f6d6573736167652d7265706f727465722e737667)[![Total Download Count](https://camo.githubusercontent.com/844de34f6840fb87da69c51fa2c01f8b2d4681ae6ce2d8679a5a0b8c7ce4a253/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a65726f656e2f6d6573736167652d7265706f727465722e737667)](https://camo.githubusercontent.com/844de34f6840fb87da69c51fa2c01f8b2d4681ae6ce2d8679a5a0b8c7ce4a253/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a65726f656e2f6d6573736167652d7265706f727465722e737667)[![codecov](https://camo.githubusercontent.com/47ae5115ad997c7db95ecc2625aa465734196043aa1a690a8775b1716c30b3b9/68747470733a2f2f636f6465636f762e696f2f67682f4a65726f656e4465446175772f6d6573736167652d7265706f727465722f67726170682f62616467652e7376673f746f6b656e3d536934354e394d734771)](https://codecov.io/gh/JeroenDeDauw/message-reporter)

An interface to report and relay arbitrary messages to registered handlers. This was part of the [Semantic MediaWiki](https://github.com/SemanticMediaWiki/SemanticMediaWiki/) code base and is now being deployed as independent library.

Requirements
------------

[](#requirements)

PHP 8.1 or later

Installation
------------

[](#installation)

The recommended installation method for this library is to add it as dependency to your [composer.json](https://getcomposer.org/).

```
{
	"require": {
		"jeroen/message-reporter": "~1.5"
	}
}
```

Usage
-----

[](#usage)

The message reporter specifies `MessageReporter` and `MessageReporterAware` as an interface for all interactions with a set of supporting classes:

- `MessageReporterFactory`
- `ObservableMessageReporter`
- `NullMessageReporter`
- `SpyMessageReporter`
- `CallbackMessageReporter`

```
use Onoi\MessageReporter\MessageReporterFactory;
use Onoi\MessageReporter\MessageReporterAware;
use Onoi\MessageReporter\MessageReporterAwareTrait;

class Bar implements MessageReporterAware {

	use MessageReporterAwareTrait;

	public function __construct() {
		$this->messageReporter = MessageReporterFactory::getInstance()->newNullMessageReporter();
	}

	public function doSomething() {
		$this->messageReporter->reportMessage( 'Doing ...' );
	}
}
```

```
use Onoi\MessageReporter\MessageReporterFactory;
use Onoi\MessageReporter\MessageReporter;

class Foo implements MessageReporter {

	public function reportMessage( $message ) {
		// output
	}
}

$foo = new Foo();

$messageReporterFactory = new MessageReporterFactory();

$observableMessageReporter = $messageReporterFactory->newObservableMessageReporter();
$observableMessageReporter->registerReporterCallback( array( $foo, 'reportMessage' ) );

or

// If the class implements the MessageReporter
$observableMessageReporter->registerMessageReporter( $foo );

$bar = new Bar();
$bar->setMessageReporter( $observableMessageReporter );
```

Contribution and support
------------------------

[](#contribution-and-support)

If you want to contribute work to the project please subscribe to the developers mailing list and have a look at the [contribution guideline](/CONTRIBUTING.md). A list of people who have made contributions in the past can be found [here](https://github.com/JeroenDeDauw/message-reporter/graphs/contributors).

- [File an issue](https://github.com/JeroenDeDauw/message-reporter/issues)
- [Submit a pull request](https://github.com/JeroenDeDauw/message-reporter/pulls)

Development
-----------

[](#development)

Start by installing the project dependencies by executing

```
composer update

```

You can run the tests by executing

```
make test

```

You can run the style checks by executing

```
make cs

```

To run all CI checks, execute

```
make ci

```

You can also invoke PHPUnit directly to pass it arguments, as follows

```
vendor/bin/phpunit --filter SomeClassNameOrFilter

```

Release notes
-------------

[](#release-notes)

### 1.5.0 (2026-03-30)

[](#150-2026-03-30)

- Publish under jeroen/message-reporter
- Bumps minimum php version to 8.1
- Add support for php 8.1-8.4

### 1.4.2 (2021-01-15)

[](#142-2021-01-15)

- Added support for PHP 8
- Changed minimum PHP version to 7.3

### 1.4.1 (2019-04-10)

[](#141-2019-04-10)

- Added `.gitattributes`

### 1.4.0 (2019-04-08)

[](#140-2019-04-08)

- Added `CallbackMessageReporter`
- Changed minimum PHP version to 5.6.99

### 1.3.0 (2017-11-05)

[](#130-2017-11-05)

- Added `MessageReporterAwareTrait`

### 1.2.0 (2016-08-02)

[](#120-2016-08-02)

- Added `MessageReporterAware` and `SpyMessageReporter`

### 1.1.0 (2016-04-13)

[](#110-2016-04-13)

- `ObservableMessageReporter::registerReporterCallback` to register only callable handlers

### 1.0.0 (2015-01-24)

[](#100-2015-01-24)

- Initial release
- `MessageReporterFactory`
- `ObservableMessageReporter`
- `NullMessageReporter`
- `MessageReporter`

License
-------

[](#license)

[GNU General Public License 2.0 or later](https://www.gnu.org/copyleft/gpl.html).

###  Health Score

55

—

FairBetter than 97% of packages

Maintenance82

Actively maintained with recent releases

Popularity29

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~583 days

Recently: every ~767 days

Total

8

Last Release

90d ago

PHP version history (5 changes)1.0.0PHP &gt;=5.3.2

1.3.0PHP &gt;=5.5

1.4.0PHP ^5.6.99|^7.0

1.4.2PHP &gt;=7.3

1.5.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/451bd4039d530fed8f9c3da91bfa519233a397d2182cdfdcad700f6cfea19b7f?d=identicon)[Jeroen De Dauw](/maintainers/Jeroen%20De%20Dauw)

![](https://www.gravatar.com/avatar/5d30e82252731745d5060a641de6e9431e1d5722ede97cb1cc94d2975aa54753?d=identicon)[malberts](/maintainers/malberts)

---

Top Contributors

[![JeroenDeDauw](https://avatars.githubusercontent.com/u/146040?v=4)](https://github.com/JeroenDeDauw "JeroenDeDauw (22 commits)")[![paladox](https://avatars.githubusercontent.com/u/5727000?v=4)](https://github.com/paladox "paladox (11 commits)")[![mwjames](https://avatars.githubusercontent.com/u/1245473?v=4)](https://github.com/mwjames "mwjames (9 commits)")[![reedy](https://avatars.githubusercontent.com/u/67615?v=4)](https://github.com/reedy "reedy (4 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (2 commits)")[![kghbln](https://avatars.githubusercontent.com/u/1104078?v=4)](https://github.com/kghbln "kghbln (2 commits)")

---

Tags

messagesreporter

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/jeroen-message-reporter/health.svg)

```
[![Health](https://phpackages.com/badges/jeroen-message-reporter/health.svg)](https://phpackages.com/packages/jeroen-message-reporter)
```

###  Alternatives

[prologue/alerts

Prologue Alerts is a package that handles global site messages.

3486.4M36](/packages/prologue-alerts)[plasticbrain/php-flash-messages

A modern take on PHP session-based flash messages

184229.7k8](/packages/plasticbrain-php-flash-messages)[coderello/laraflash

Advanced flash messages for Laravel.

15737.2k1](/packages/coderello-laraflash)[tatter/alerts

Lightweight user alerts for CodeIgniter 4

3978.7k6](/packages/tatter-alerts)[cartalyst/alerts

Alerts allows you to easily pass alert messages to your Laravel views.

2668.8k](/packages/cartalyst-alerts)[gerardojbaez/messenger

Messenger functionality for Laravel 5.2.

728.5k](/packages/gerardojbaez-messenger)

PHPackages © 2026

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