VOOZH about

URL: https://deepwiki.com/hypervel/notifications

⇱ hypervel/notifications | DeepWiki


Loading...
Menu

Overview

This document introduces the hypervel/notifications package, its purpose, core capabilities, and architectural components. It provides a high-level understanding of how the notification system integrates with the Hypervel framework to deliver multi-channel notifications.

For detailed information about specific components, see:

Purpose

The hypervel/notifications package provides a unified API for sending notifications across multiple delivery channels including email, Slack, real-time broadcasts, and database storage. The package abstracts channel-specific delivery logic, supports asynchronous processing through queue integration, and provides extensibility through PSR-14 event dispatching and custom channel registration.

Sources: composer.json1-59

Key Capabilities

The notification system offers the following core capabilities:

CapabilityDescriptionKey Components
Multi-Channel DeliverySend notifications through mail, Slack, broadcast, and database channelsChannelManager, channel implementations
Asynchronous ProcessingQueue notifications for background processing with retry logicSendQueuedNotifications, queue integration
Rich Message ConstructionBuild structured messages with channel-specific featuresMailMessage, SlackMessage, Block Kit components
Anonymous NotificationsSend to arbitrary recipients without persistent entitiesAnonymousNotifiable
Locale ManagementApply locale context for notification contentNotificationSender locale handling
Event-Driven HooksObserve and control notification lifecycle through eventsNotificationSending, NotificationSent events
Object PoolingReuse expensive driver instances for performanceNotificationPoolProxy
Custom ChannelsRegister custom delivery channels through extension APIChannelManager::extend()

Sources: composer.json1-59

Framework Dependencies

The package builds on the Hyperf 3.1 framework and integrates with several Hypervel ecosystem components:

Core Hyperf Dependencies


Sources: composer.json28-41

System Architecture

The notification system consists of three primary architectural layers:


Core Components

ComponentFile PathResponsibility
NotificationServiceProvidersrc/NotificationServiceProvider.phpLoads notification views from publish/resources/views directory
ConfigProviderReferenced in composer.jsonRegisters package configuration with framework
ChannelManagerCore orchestrationResolves channels, manages driver lifecycle, contextual configuration
NotificationSenderCore orchestrationOrchestrates delivery across channels, manages locale, dispatches events
SendQueuedNotificationsQueue integrationProcesses queued notifications asynchronously with retry logic

Sources: src/NotificationServiceProvider.php1-16 composer.json46-54

Notification Flow

The following sequence demonstrates the basic notification delivery flow:


Synchronous vs Asynchronous Processing

Processing ModeTriggerFlow
SynchronousNotification does not implement ShouldQueueChannelManagerNotificationSender::send() → immediate channel delivery
AsynchronousNotification implements ShouldQueueChannelManagerNotificationSender::send()SendQueuedNotifications job → queue storage → worker → NotificationSender::sendNow() → channel delivery

Sources: Analysis of system architecture diagrams provided

Package Registration

The package registers with the Hyperf/Hypervel framework through two providers:

ConfigProvider

Registered via composer.json extra configuration:


The ConfigProvider registers package configuration and bindings with the dependency injection container.

Sources: composer.json46-49

NotificationServiceProvider

Registered via composer.json Hypervel providers:


The NotificationServiceProvider loads notification view templates from the publish/resources/views directory using the notifications namespace.

Sources: composer.json50-53 src/NotificationServiceProvider.php9-14

Channel Types

The package provides built-in support for multiple delivery channels:

ChannelPurposeMessage TypeExternal Integration
MailEmail deliveryMailMessagehypervel/mail MailFactory
BroadcastReal-time WebSocket eventsBroadcastMessagehypervel/broadcasting
DatabasePersist notifications to databaseGenerichyperf/database ORM
Slack (Web API)Slack message via chat.postMessageSlackMessageSlack Web API
Slack (Webhook)Slack message via incoming webhookSlackMessageSlack Webhook URL

For detailed information about specific channels, see Notification Channels.

Sources: Analysis of system architecture diagrams provided

Extensibility

The system provides multiple extension points:

Custom Channels

Register custom delivery channels using ChannelManager::extend():


See Extending the System for detailed guidance.

Event Listeners

Attach PSR-14 event listeners to observe notification lifecycle:

  • NotificationSending: Fired before channel delivery (cancellable)
  • NotificationSent: Fired after successful delivery
  • BroadcastNotificationCreated: Fired for broadcast channel notifications

Object Pooling

Expensive channel drivers can be wrapped in NotificationPoolProxy for instance reuse, improving performance for high-throughput scenarios.

Sources: Analysis of system architecture diagrams provided

License

The package is released under the MIT License with copyright held by Taylor Otwell and Hypervel.

Sources: LICENSE.md1-23

Next Steps