betocampoy/champs-notification-center 问题修复 & 功能扩展

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

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

betocampoy/champs-notification-center

最新稳定版本:v1.0.0

Composer 安装命令:

composer require betocampoy/champs-notification-center

包简介

Champs Notification Center - backend package for standardized notifications compatible with Champs Frontend.

README 文档

README

Pacote POC para padronizar uma central de notificações reutilizável em projetos legados e Symfony.

Frontend esperado: data-champs-notification-center do champs-frontend/champs-core-js.

Instalação local para teste

No projeto consumidor:

{
  "repositories": [
    {
      "type": "path",
      "url": "../champs-notification-center",
      "options": { "symlink": true }
    }
  ],
  "require": {
    "betocampoy/champs-notification-center": "*@dev"
  }
}

Depois:

composer update betocampoy/champs-notification-center

Tabela

Execute o SQL:

database/mysql.sql

Uso legado com PDO

use BetoCampoy\Champs\NotificationCenter\Repository\PdoNotificationRepository;
use BetoCampoy\Champs\NotificationCenter\Service\NotificationDispatcher;
use BetoCampoy\Champs\NotificationCenter\Service\NotificationReader;
use BetoCampoy\Champs\NotificationCenter\Service\NotificationActionHandler;

$repository = new PdoNotificationRepository($pdo);
$dispatcher = new NotificationDispatcher($repository);
$reader = new NotificationReader($repository);
$actions = new NotificationActionHandler($repository);

$dispatcher->dispatch(
    recipientType: 'user',
    recipientId: '1',
    subject: 'Boleto gerado',
    body: 'O boleto foi gerado com sucesso.',
    link: '/financeiro/boletos/123',
    type: 'finance'
);

Endpoints esperados pelo frontend

Counter

{
  "success": true,
  "unread": 3
}

Lista

{
  "success": true,
  "unread": 3,
  "items": [
    {
      "id": 1,
      "subject": "DC-e autorizada",
      "body": "A declaração foi autorizada.",
      "link": "/fiscal/document/1",
      "read": false,
      "createdAt": "27/04/2026 10:00",
      "media": null
    }
  ]
}

Symfony

A pasta config/routes.yaml contém rotas POC:

champs_notification_counter:
  path: /champs/notifications/counter

Na primeira versão, o controller Symfony resolve o recipient por headers:

  • X-Champs-Recipient-Type
  • X-Champs-Recipient-Id

No projeto real, vamos trocar por Security->getUser() ou um RecipientResolverInterface.

Firebase

A interface PushNotificationProviderInterface já existe. A classe FirebaseMessagingProvider é placeholder para a próxima evolução com Firebase Cloud Messaging HTTP v1.

Status

Versão POC para testes no legado e no Symfony.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固