Download the PHP package azaharizaman/nexus-messaging without Composer
On this page you can find all versions of the php package azaharizaman/nexus-messaging. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download azaharizaman/nexus-messaging
More information about azaharizaman/nexus-messaging
Files in azaharizaman/nexus-messaging
Package nexus-messaging
Short Description Channel-agnostic, immutable communication record management for Email, SMS, Chat, Webhooks with protocol abstraction
License MIT
Informations about the package nexus-messaging
Nexus\Messaging
Channel-agnostic, immutable communication record management for Email, SMS, Chat, WhatsApp, and more.
๐ฆ Overview
Nexus\Messaging is a framework-agnostic PHP package that provides atomic, stateless management of communication records across multiple channels (Email, SMS, WhatsApp, iMessage, Phone Calls, etc.). It separates the WHAT (immutable record of conversation) from the HOW (protocol-specific sending logic), making it a reusable, protocol-agnostic foundation for any communication system.
Key Principles
- ๐ Immutable Records: Once created, message records cannot be modified (append-only timeline)
- ๐ Protocol Abstraction: Supports any provider (Twilio, SendGrid, Meta) via connector interface
- ๐ข Multi-Tenant: Native tenant isolation for SaaS applications
- ๐ Compliance-Ready: PII flags, archival policies, audit trails
- โก Framework-Agnostic: Pure PHP 8.3 - works with Laravel, Symfony, or vanilla PHP
๐ฏ Use Cases
- Customer Support Systems: Build conversation timelines on case/ticket screens
- CRM Platforms: Track all customer communications in one place
- Marketing Automation: Store campaign messages with delivery tracking
- Multi-Channel Messaging: Unify Email, SMS, WhatsApp under single API
- Compliance & Audit: Immutable records for SOX, GDPR, HIPAA
- ERP Systems: Communication history on orders, invoices, shipments
๐ Installation
โจ Features
Level 1 (MVP)
- โ
Immutable
MessageRecordvalue object - โ Channel abstraction (Email, SMS, WhatsApp, etc.)
- โ Direction tracking (Inbound/Outbound)
- โ Repository interface for persistence
- โ Entity association (build conversation timelines)
- โ Audit event integration
Level 2 (Professional)
- โ Delivery status tracking (Pending โ Sent โ Delivered โ Failed)
- โ Provider reference IDs (Twilio SID, SendGrid ID, etc.)
- โ Connector interface for external providers
- โ Inbound webhook processing
- โ Tenant isolation (multi-tenant SaaS)
- โ Attachment metadata (no file I/O)
- โ Channel-specific metadata storage
Level 3 (Enterprise)
- โ Rate limiting interface
- โ PII compliance flags
- โ Template engine abstraction
- โ Optimized timeline queries
- โ SSO user attribution
- โ Archival status (retention policies)
- โ Encryption neutrality
๐ Quick Start
1. Implement Repository Interface
2. Implement Connector Interface
3. Send Outbound Message
4. Process Inbound Webhook
5. Build Conversation Timeline
๐๏ธ Architecture
Value Objects
MessageRecord- Immutable aggregate root containing all message dataAttachmentMetadata- Attachment references (no file I/O)
Enums
Channel- Communication channels (Email, SMS, WhatsApp, etc.)Direction- Message flow (Inbound/Outbound)DeliveryStatus- Delivery lifecycle (Pending, Sent, Delivered, Failed)ArchivalStatus- Retention policy status
Contracts
MessagingRepositoryInterface- Persistence abstractionMessagingConnectorInterface- External provider abstractionRateLimiterInterface- High-volume throttlingMessageTemplateEngineInterface- Template rendering
Services
MessageManager- Core orchestrator (send, receive, query)
๐ Supported Channels & Providers
The package is protocol-agnostic. The application layer implements connectors for specific providers:
| Channel | Example Providers | Implementation |
|---|---|---|
| SendGrid, Postmark, AWS SES, SMTP | Via MessagingConnectorInterface |
|
| SMS | Twilio, Nexmo, AWS SNS | Via MessagingConnectorInterface |
| Twilio WhatsApp API, Meta Business API | Via MessagingConnectorInterface |
|
| iMessage | Apple Business Chat | Via MessagingConnectorInterface |
| Phone Call | Twilio Voice, SIP | Log call notes as messages |
| Chat | Slack, Discord, MS Teams | Via MessagingConnectorInterface |
| Webhook | Custom HTTP webhooks | Generic webhook handler |
| Internal Note | Internal system notes | No external provider |
๐ Protocol Abstraction Pattern
Key Insight: The package defines Channel::WhatsApp without knowing what WhatsApp is. The connector implementation knows the Twilio-specific API details.
๐ Compliance & Security
PII Handling (L3.2)
Application layer can:
- Encrypt body before persistence
- Restrict access logs
- Apply stricter retention policies
Encryption Neutrality (L3.7)
The package NEVER encrypts data itself. Encryption is the application layer's responsibility:
Archival Policies (L3.6)
โก High-Volume Optimization
Rate Limiting (L3.1)
Optimized Timeline Loading (L3.4)
๐งช Testing
Example test:
๐ Available Interfaces
MessagingRepositoryInterface
MessagingConnectorInterface
RateLimiterInterface (Optional)
MessageTemplateEngineInterface (Optional)
๐ Integration with Other Nexus Packages
| Package | Integration Point | Usage |
|---|---|---|
| Nexus\Party | senderPartyId, recipientPartyId |
Link messages to Party entities |
| Nexus\AuditLogger | Optional $auditLogger callback |
Log "message_sent", "message_received" events |
| Nexus\Connector | Application layer uses it | External API integration |
| Nexus\Tenant | tenantId field |
Multi-tenant isolation |
| Nexus\Telemetry | Optional TelemetryTrackerInterface |
Track message metrics |
| Nexus\SSO | User attribution | senderPartyId from authenticated user |
๐ Best Practices
- Always use ULIDs for message IDs - Sortable, globally unique
- Set
containsPIIflag - When messages contain sensitive data - Implement rate limiting - For production environments
- Use optimized queries -
findLatestByEntity()for UI timelines - Validate provider responses - In connector implementations
- Log delivery failures - For debugging and monitoring
- Test webhook parsers - Validate all provider webhook formats
๐ Documentation
- Getting Started - Quick start guide
- API Reference - Complete API documentation
- Integration Guide - Laravel/Symfony examples
- Examples - Working code samples
- Requirements - All 20 requirements tracked
- Implementation Summary - Development metrics
- Test Suite Summary - Test coverage report
- Valuation Matrix - Package business value
๐ค Contributing
This package follows strict Nexus architectural guidelines:
- โ Framework-agnostic (no Laravel/Symfony dependencies)
- โ
Immutable value objects with
readonlyproperties - โ Native PHP 8.3 enums
- โ Constructor property promotion
- โ
Strict types (
declare(strict_types=1)) - โ PSR-12 coding standards
- โ 95%+ test coverage
๐ License
MIT License. See LICENSE for details.
๐ Credits
Developed by the Nexus Development Team as part of the Nexus ERP ecosystem.
Package Status: โ
Production Ready
Version: 1.0.0
Last Updated: November 24, 2025
๐ Documentation
Package Documentation
- Getting Started Guide - Quick start guide with prerequisites and basic configuration
- API Reference - Complete documentation of all interfaces and components
- Integration Guide - Laravel and Symfony integration examples
- Basic Usage Example - Simple usage patterns
- Advanced Usage Example - Advanced scenarios
Additional Resources
IMPLEMENTATION_SUMMARY.md- Implementation progress and metricsREQUIREMENTS.md- Detailed requirementsTEST_SUITE_SUMMARY.md- Test coverage and resultsVALUATION_MATRIX.md- Package valuation metrics- See root
ARCHITECTURE.mdfor overall system architecture