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-TypeX-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
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-29