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

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

onoi/message-reporter
=====================

An interface to report and relay arbitrary messages to registered handlers

1.4.2(5y ago)3655.8k↑88%13GPL-2.0-or-laterPHPPHP &gt;=7.3

Since Jan 24Pushed 5y ago3 watchersCompare

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

READMEChangelog (7)Dependencies (5)Versions (8)Used By (3)

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

39

—

LowBetter than 86% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community21

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 57.6% 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 ~364 days

Recently: every ~407 days

Total

7

Last Release

1949d ago

PHP version history (4 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

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/372f9bc1233d5518b9522cb681210a8de2765a3a9bbde20138f6ad5332a411ca?d=identicon)[mwjames](/maintainers/mwjames)

![](https://www.gravatar.com/avatar/511b3dbc1a73ad7b69118e540b16c8bcc2ac5f923022b94aa61a8d71af612f9c?d=identicon)[onoi](/maintainers/onoi)

---

Top Contributors

[![JeroenDeDauw](https://avatars.githubusercontent.com/u/146040?v=4)](https://github.com/JeroenDeDauw "JeroenDeDauw (19 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)")

---

Tags

messagesreporter

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[prologue/alerts

Prologue Alerts is a package that handles global site messages.

3486.1M30](/packages/prologue-alerts)[plasticbrain/php-flash-messages

A modern take on PHP session-based flash messages

184229.6k8](/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

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

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

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

Messenger functionality for Laravel 5.2.

738.5k](/packages/gerardojbaez-messenger)

PHPackages © 2026

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