comphp/notifications 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

comphp/notifications

Composer 安装命令:

composer require comphp/notifications

包简介

Driver-based notification delivery for email, SMS, webhooks, and messaging APIs in CommonPHP applications

README 文档

README

CommonPHP Notifications provides driver-based notification delivery for CommonPHP applications. It defines the common structure for sending application notifications through channels such as email, SMS, webhooks, and third-party messaging APIs.

The package is centered around a notifier service, notification objects, recipients, delivery results, and channel-specific drivers. It is intended to provide the shared notification layer while keeping provider-specific behavior in separate driver packages.

Requirements

  • PHP ^8.5
  • comphp/runtime:^0.3

Installation

Once this package is available through your Composer repositories, install it with:

composer require comphp/notifications

Usage

<?php

use CommonPHP\Notifications\Notification;
use CommonPHP\Notifications\Notifier;

$notifier = new Notifier();

$notification = new Notification(
    subject: 'Welcome',
    body: 'Thanks for signing up.',
    recipients: ['user@example.com']
);

$notifier->send($notification, channel: 'email');

$notifications->sendTemplate(
    template: 'auth.password-reset',
    data: ['url' => $url],
    channel: 'email',
    recipients: [...]
);

$notifications->channel('sms')->send(
    new Notification(
        body: 'Your verification code is 123456.',
        recipients: ['+15555555555'],
    )
);

Package Notes

This package should define the core notification contracts, notifier service, notification message objects, recipients, delivery results, and driver integration points.

Provider-specific delivery belongs in separate driver packages, such as SMTP, SendGrid, Twilio, Slack, Teams, or webhook notification drivers.

The package should focus on application notifications, not general-purpose chat, queueing, marketing automation, or real-time messaging.

Error Handling

Notification creation, channel lookup, driver resolution, delivery, and provider failures should throw CommonPHP notification exceptions instead of returning ambiguous false values.

Drivers should return structured delivery results when a notification was processed and should throw exceptions when delivery cannot be attempted safely.

Documentation

License

MIT. See LICENSE.md.

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 5
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固