PHPackages                             icehawk/pubsub - 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. [Framework](/categories/framework)
4. /
5. icehawk/pubsub

ActiveLibrary[Framework](/categories/framework)

icehawk/pubsub
==============

Publish subscribe component for IceHawk framework

v1.0.1(9y ago)38.4k1MITPHPPHP &gt;=7.0

Since Aug 12Pushed 7y ago1 watchersCompare

[ Source](https://github.com/icehawk/pubsub)[ Packagist](https://packagist.org/packages/icehawk/pubsub)[ RSS](/packages/icehawk-pubsub/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (1)Versions (4)Used By (0)

[![Join the chat at https://gitter.im/icehawk/pubsub](https://camo.githubusercontent.com/5b5facd26474caac97f9877afba08f34c74201e5d1cdf671e71d182ab5b98f2c/68747470733a2f2f6261646765732e6769747465722e696d2f6963656861776b2f7075627375622e737667)](https://gitter.im/icehawk/pubsub?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)[![Build Status](https://camo.githubusercontent.com/20cd60e4d8ca02b398a94678c85e65ff443bb88a2b91858c1303034dc7050a20/68747470733a2f2f7472617669732d63692e6f72672f6963656861776b2f7075627375622e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/icehawk/pubsub)[![Coverage Status](https://camo.githubusercontent.com/415f79649a742b9ef1a56d37909c704aa737db4c1a3fc0a54c3bcdd94a1be693/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6963656861776b2f7075627375622f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/icehawk/pubsub?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/1180b301b1ac8271806263703c08ac6fe4b76a3deec1cab2920d25100bccac22/68747470733a2f2f706f7365722e707567782e6f72672f6963656861776b2f7075627375622f762f737461626c65)](https://packagist.org/packages/icehawk/pubsub)[![Total Downloads](https://camo.githubusercontent.com/c5d1a2239ddb953ac718f1287a2dff2ec9ee886b2507a28972ee904e8e8d8785/68747470733a2f2f706f7365722e707567782e6f72672f6963656861776b2f7075627375622f646f776e6c6f616473)](https://packagist.org/packages/icehawk/pubsub)[![Latest Unstable Version](https://camo.githubusercontent.com/4a32a419f8ada2d6d9b36c3614d4491dd8e454c55798fcd07eb228ee2b9b080e/68747470733a2f2f706f7365722e707567782e6f72672f6963656861776b2f7075627375622f762f756e737461626c65)](https://packagist.org/packages/icehawk/pubsub)[![License](https://camo.githubusercontent.com/5ecb834e962d329ef855691f6083e982f8e28706905ff4b893025bfb0992d83c/68747470733a2f2f706f7365722e707567782e6f72672f6963656861776b2f7075627375622f6c6963656e7365)](https://packagist.org/packages/icehawk/pubsub)

[![IceHawk Framework](https://camo.githubusercontent.com/fa32101fc112c08d4929e95df4e71bb95df786d722981a1e17053714680bcdd7/68747470733a2f2f6963656861776b2e6769746875622e696f2f696d616765732f4c6f676f2d466c79696e672d5461696c2d57686974652e706e67)](https://camo.githubusercontent.com/fa32101fc112c08d4929e95df4e71bb95df786d722981a1e17053714680bcdd7/68747470733a2f2f6963656861776b2e6769746875622e696f2f696d616765732f4c6f676f2d466c79696e672d5461696c2d57686974652e706e67)
==============================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#)

IceHawk\\PubSub
===============

[](#icehawkpubsub)

Publish-Subscribe component for the [IceHawk](https://github.com/icehawk/icehawk) framework.

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

[](#requirements)

- PHP &gt;= 7.0

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

[](#installation)

```
composer require "icehawk/pubsub:^1.0"

```

Usage
-----

[](#usage)

### Create a message

[](#create-a-message)

**Please note:**

- Messages should always be immutable.
- Every message MUST have a:
    - Message ID
    - Message name

... and of course user-defined content, so called payload.

IceHawk/PubSub shipps with 2 types/value objects for the message ID and message name. If you don't want / can't use them for any reason, you can alternativly implement their interfaces.

Shipped type / value objectInterface`IceHawk\PubSub\Types\MessageId``IceHawk\PubSub\Interfaces\IdentifiesMessage``IceHawk\PubSub\Types\MessageName``IceHawk\PubSub\Interfaces\NamesMessage`The message itself MUST implement the following interface:

`IceHawk\PubSub\Interfaces\CarriesInformation`

So a message implementation could look like this:

```
