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

ActiveLibrary

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

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

00[2 PRs](https://github.com/JeroenDeDauw/message-reporter/pulls)PHP

Since Mar 29Pushed 1mo agoCompare

[ Source](https://github.com/JeroenDeDauw/message-reporter)[ Packagist](https://packagist.org/packages/jeroen/message-reporter)[ RSS](/packages/jeroen-message-reporter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

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

[](#message-reporter)

[![Build Status](https://camo.githubusercontent.com/5d049368fa080bd9fb3c660b042acad729353f37eb30a392e0eab4bf9e60e009/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f6f6e6f692f6d6573736167652d7265706f727465722e7376673f6272616e63683d6d6173746572)](http://travis-ci.org/onoi/message-reporter)[![Code Coverage](https://camo.githubusercontent.com/7122696be7fa184146e9bc707e8f81d46f1acf2e2331b0a9c442b609986d223e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6f6e6f692f6d6573736167652d7265706f727465722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/onoi/message-reporter/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/dbffe4f5bb4de4372d61e55ac2b4faab49b8a484d4a8a2a62b874135b9e6b395/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6f6e6f692f6d6573736167652d7265706f727465722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/onoi/message-reporter/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/74e3d8c53672a64c8ef499df47b79089a144de2c21a0575884a9d438956deec2/68747470733a2f2f706f7365722e707567782e6f72672f6f6e6f692f6d6573736167652d7265706f727465722f76657273696f6e2e706e67)](https://packagist.org/packages/onoi/message-reporter)[![Packagist download count](https://camo.githubusercontent.com/0d0b8e7b8cbee44e8fe5dee25a092e855001b3f107a57f59592a0d4afd617769/68747470733a2f2f706f7365722e707567782e6f72672f6f6e6f692f6d6573736167652d7265706f727465722f642f746f74616c2e706e67)](https://packagist.org/packages/onoi/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 7.3 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": {
		"onoi/message-reporter": "~1.4"
	}
}
```

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 guidelinee](/CONTRIBUTING.md). A list of people who have made contributions in the past can be found [here](https://github.com/onoi/message-reporter/graphs/contributors).

- [File an issue](https://github.com/onoi/message-reporter/issues)
- [Submit a pull request](https://github.com/onoi/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.4.2 (2021-01-15)

    - Added support for PHP 8
    - Changed minimum PHP version to 7.3
- 1.4.1 (2019-04-10)

    - Added `.gitattributes`
- 1.4.0 (2019-04-08)

    - Added `CallbackMessageReporter`
    - Changed minimum PHP version to 5.6.99
- 1.3.0 (2017-11-05)

    - Added `MessageReporterAwareTrait`
- 1.2.0 (2016-08-02)

    - Added `MessageReporterAware` and `SpyMessageReporter`
- 1.1.0 (2016-04-13)

    - `ObservableMessageReporter::registerReporterCallback` to register only callable handlers
- 1.0.0 (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

21

—

LowBetter than 19% of packages

Maintenance60

Regular maintenance activity

Popularity0

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 Bus Factor1

Top contributor holds 61.1% 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.

### 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)")[![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 (3 commits)")[![kghbln](https://avatars.githubusercontent.com/u/1104078?v=4)](https://github.com/kghbln "kghbln (2 commits)")

### 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)
```

PHPackages © 2026

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