PHPackages                             mmi/mmi-cms-event-publisher - 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. mmi/mmi-cms-event-publisher

ActiveLibrary[Framework](/categories/framework)

mmi/mmi-cms-event-publisher
===========================

The CMS written with MMi Framework

1.0.15(1y ago)07.3k↓40.8%MITPHPCI passing

Since Nov 30Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/milejko/mmi-cms-event-publisher)[ Packagist](https://packagist.org/packages/mmi/mmi-cms-event-publisher)[ RSS](/packages/mmi-mmi-cms-event-publisher/feed)WikiDiscussions master Synced yesterday

READMEChangelog (6)Dependencies (3)Versions (18)Used By (0)

mmi-cms-event-publisher
=======================

[](#mmi-cms-event-publisher)

A PHP library for publishing CMS category events to message queues (AMQP/RabbitMQ) or in-memory storage. Part of the MMi CMS ecosystem.

Quick Start
-----------

[](#quick-start)

```
git clone  mmi-cms-event-publisher
cd mmi-cms-event-publisher
composer install
composer test:all
```

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

[](#requirements)

- PHP 8.4+
- Composer
- ext-amqp (for RabbitMQ support)

Development Setup
-----------------

[](#development-setup)

### Install Dependencies

[](#install-dependencies)

```
composer install
```

### Run Tests

[](#run-tests)

```
# Run PHPUnit tests
composer test:phpunit

# Run all quality checks (security, phpcs, phpstan, phpmd, phpunit)
composer test:all
```

### Code Quality

[](#code-quality)

```
# Static analysis
composer test:phpstan

# Code style check
composer test:phpcs

# Mess detection
composer test:phpmd

# Auto-fix code style issues
composer fix:all
```

Architecture
------------

[](#architecture)

### Core Components

[](#core-components)

**Messages** - Represent CMS category operations:

- `MessageInterface` - Contract for all messages
- `AbstractCategoryMessage` - Base class handling JSON serialization
- `UpdateCategoryMessage` - Category update events
- `DeleteCategoryMessage` - Category delete events

**Publishers** - Handle message delivery:

- `MessagePublisherInterface` - Publisher contract
- `InMemoryMessagePublisher` - In-memory storage (testing/dev)
- `AmqpMessagePublisher` - RabbitMQ publisher (production)

### Design Pattern

[](#design-pattern)

The library uses the Strategy pattern with interface-based design. The DI container automatically selects the appropriate publisher based on configuration.

```
MessageInterface ← AbstractCategoryMessage ← Update/DeleteCategoryMessage
MessagePublisherInterface ← InMemoryMessagePublisher | AmqpMessagePublisher

```

Configuration
-------------

[](#configuration)

Environment variables control publisher behavior:

VariableDefaultDescription`CMS_PUBLISHER_QUEUE_ENABLED``false`Enable RabbitMQ publishing`CMS_PUBLISHER_QUEUE_HOST``localhost`RabbitMQ host`CMS_PUBLISHER_QUEUE_PORT``5672`RabbitMQ port`CMS_PUBLISHER_QUEUE_VHOST``cms`RabbitMQ virtual host`CMS_PUBLISHER_QUEUE_USERNAME``''`RabbitMQ username`CMS_PUBLISHER_QUEUE_PASSWORD``''`RabbitMQ password`CMS_PUBLISHER_QUEUE_EXCHANGE``cms.content.updates`Exchange nameUsage
-----

[](#usage)

### Basic Integration

[](#basic-integration)

```
// Include DI configuration in your container setup
// di.publisher.php handles publisher selection automatically

// Inject MessagePublisherInterface where needed
$publisher = $container->get(MessagePublisherInterface::class);

// Create and publish messages
$message = new UpdateCategoryMessage($categoryRecord);
$publisher->publish($message);
```

### Testing

[](#testing)

Use `InMemoryMessagePublisher` directly for unit tests:

```
$publisher = new InMemoryMessagePublisher();
$publisher->publish(new UpdateCategoryMessage($category));

$messages = $publisher->getMessages(); // Access published messages
```

Project Structure
-----------------

[](#project-structure)

```
src/CmsEventPublisher/
├── AbstractCategoryMessage.php    # Base message class
├── AmqpMessagePublisher.php       # RabbitMQ implementation
├── DeleteCategoryMessage.php      # Delete event
├── di.publisher.php               # DI configuration
├── InMemoryMessagePublisher.php   # In-memory implementation
├── MessageInterface.php           # Message contract
├── MessagePublisherInterface.php  # Publisher contract
└── UpdateCategoryMessage.php      # Update event

tests/
├── Mock/                          # Test mocks
└── Unit/                          # Unit tests

```

Docker
------

[](#docker)

Build development container:

```
docker build --build-arg PHP_VERSION=8.4 -t mmi-cms-event-publisher .
```

CI/CD
-----

[](#cicd)

GitHub Actions runs on PRs and pushes:

- Tests against PHP 8.4 and 8.5
- Runs full quality suite (phpcs, phpstan, phpmd, phpunit)
- Builds Docker image

Code Standards
--------------

[](#code-standards)

- **Coding:** PSR-2
- **Static Analysis:** PHPStan Level 8
- **Mess Detection:** PHPMD (Clean Code, Design, Unused Code)
- **License:** MIT

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance68

Regular maintenance activity

Popularity23

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.9% 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 ~50 days

Recently: every ~72 days

Total

17

Last Release

512d ago

### Community

Maintainers

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

---

Top Contributors

[![milejko](https://avatars.githubusercontent.com/u/14335568?v=4)](https://github.com/milejko "milejko (26 commits)")[![paweljelonek](https://avatars.githubusercontent.com/u/912989?v=4)](https://github.com/paweljelonek "paweljelonek (1 commits)")[![Wojciechem](https://avatars.githubusercontent.com/u/4303141?v=4)](https://github.com/Wojciechem "Wojciechem (1 commits)")

---

Tags

mmimmi-cms

### Embed Badge

![Health badge](/badges/mmi-mmi-cms-event-publisher/health.svg)

```
[![Health](https://phpackages.com/badges/mmi-mmi-cms-event-publisher/health.svg)](https://phpackages.com/packages/mmi-mmi-cms-event-publisher)
```

###  Alternatives

[magento/community-edition

Magento 2 (Open Source)

12.2k53.6k13](/packages/magento-community-edition)[bschmitt/laravel-amqp

AMQP wrapper for Laravel and Lumen to publish and consume messages

2822.5M7](/packages/bschmitt-laravel-amqp)[utopia-php/queue

A powerful task queue.

11243.0k6](/packages/utopia-php-queue)

PHPackages © 2026

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