notification-hub/hub
Composer 安装命令:
composer require notification-hub/hub
包简介
A reusable, extensible, and production-ready notification system for PHP
关键字:
README 文档
README
A reusable, extensible, and production-ready notification system for PHP.
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
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-04