A reusable, extensible, and production-ready notification system for PHP

Maintainers

Package info

github.com/YoussefMansour9/notification-hub-

pkg:composer/notification-hub/hub

Transparency log

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main 2026-07-04 22:10 UTC

This package is auto-updated.

Last update: 2026-07-04 22:23:36 UTC


README

A reusable, extensible, and production-ready notification system for PHP.

CI Latest Stable Version

Installation

composer require notification-hub/hub

Requirements

  • PHP >= 8.3
  • ext-pdo
  • MySQL or SQLite (via PDO)

Quick Start

use NotificationHub\Domain\Aggregate\Delivery;
use NotificationHub\Domain\ValueObject\ChannelType;
use NotificationHub\Domain\ValueObject\Notification;
use NotificationHub\Domain\ValueObject\Recipient;

$delivery = new Delivery(
    id: DeliveryId::generate(),
    notification: new Notification('Welcome!', 'Hello, friend.'),
    recipient: new Recipient('user-123', email: 'friend@example.com'),
    channelType: ChannelType::EMAIL,
);

Architecture

Domain (no framework deps)
  Aggregate: Delivery (status, attempts, idempotency)
  Value Objects: Notification, Recipient, ChannelType, DeliveryStatus
  Repository: DeliveryRepositoryInterface
  Events: DeliveryCreated, DeliverySent, DeliveryFailed, ...

Application (orchestration)
  Commands: SendNotification, CancelDelivery, RetryFailedDelivery
  Queries: GetDeliveryHistory, GetPendingDeliveries
  Handlers, Event Subscribers, Workers

Infrastructure (concrete implementations)
  Persistence: PdoDeliveryRepository
  Channels: EmailChannel, SmsChannel
  Providers: SendGrid, Twilio (via interfaces)

Features

  • Multi-Channel: Email, SMS, Push, Slack, Webhooks
  • CQRS: Separate command and query buses
  • Retry Logic: Exponential backoff for failed deliveries
  • Idempotency: Duplicate detection via idempotency keys
  • Event-Driven: Domain events for extensibility
  • Metrics Interface: Plug in Prometheus/Datadog
  • SQLite/MySQL: Works with both via PDO

Testing

vendor/bin/phpunit

Testing with API + UI

See examples/ and ui/ directories for a working demo.

License

MIT