定制 yourcreativepeople/statamic-notifications 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

yourcreativepeople/statamic-notifications

Composer 安装命令:

composer require yourcreativepeople/statamic-notifications

包简介

Firebase push notifications and in-app notifications for Statamic.

README 文档

README

Firebase push notifications and in-app notifications for Statamic. Ships with an FCM token store, push sender, and helper templates for notification lists.

Features

  • Firebase Cloud Messaging (web push) integration
  • Per-user notification preferences (email / push / both)
  • In-app notifications stored on Statamic users
  • Admin manual notification endpoint
  • Notification list partials + unread badge modifier
  • Service worker + Firebase config endpoint

Installation

1) Require the package

composer require yourcreativepeople/statamic-notifications

2) Publish config, migrations, and assets

php artisan vendor:publish --tag=statamic-notifications-config
php artisan vendor:publish --tag=statamic-notifications-migrations
php artisan vendor:publish --tag=statamic-notifications-assets
php artisan vendor:publish --tag=statamic-notifications-views
php artisan vendor:publish --tag=statamic-notifications-blueprints

3) Run migrations

php artisan migrate

4) Add the notification fields to your user blueprint

  • Copy resources/blueprints/vendor/statamic-notifications/user_notifications_fields.yaml into your user blueprint.

Firebase setup (web push)

1) Create a Firebase project at https://console.firebase.google.com. 2) Add a Web App to the project (Project settings -> General -> Your apps). 3) Copy the Firebase config values into your .env:

FIREBASE_API_KEY=...
FIREBASE_AUTH_DOMAIN=...
FIREBASE_PROJECT_ID=...
FIREBASE_STORAGE_BUCKET=...
FIREBASE_MESSAGING_SENDER_ID=...
FIREBASE_APP_ID=...
FIREBASE_VAPID_PUBLIC_KEY=...

4) Generate a VAPID key (Project settings -> Cloud Messaging -> Web configuration). 5) Create a service account:

  • Project settings -> Service accounts -> Generate new private key.
  • Save the JSON to config/firebase-credentials.json (or update FIREBASE_SERVICE_ACCOUNT).

Front-end setup

1) Ensure the service worker exists at public/firebase-messaging-sw.js.

  • This package publishes one that imports /notifications/firebase-config.js.

2) Add the scripts to your base layout (Antlers example):

{{ notifications:scripts }}

3) Add a button to request permission:

<button type="button" data-notifications-enable>Enable Notifications</button>

Templates

This package ships with minimal Antlers templates you can publish and customize:

  • resources/views/vendor/statamic-notifications/partials/notifications_list.antlers.html
  • resources/views/vendor/statamic-notifications/partials/notification_badge.antlers.html
  • resources/views/vendor/statamic-notifications/templates/notifications.antlers.html
  • resources/views/vendor/statamic-notifications/templates/admin_notifications.antlers.html

Use in a page:

{{ partial:statamic-notifications::partials/notifications_list title="Notifications" }}

Routes

All routes are configurable in config/statamic-notifications.php. Default endpoints:

  • POST /notify
  • POST /admin/notify
  • POST /api/notifications/token
  • POST /api/notifications/clear
  • POST /api/notifications/read
  • POST /api/notifications/remove
  • GET /notifications/firebase-config.js

Security

Set STATAMIC_NOTIFICATIONS_API_KEY to require the header X-Notifications-Key for push endpoints.

Testing / maintenance

  • Cleanup duplicate tokens:
    php artisan statamic-notifications:cleanup-tokens
    

Notes

  • If you use a CSP, allow https://www.gstatic.com for Firebase scripts.
  • Your site must be served over HTTPS for push notifications.

yourcreativepeople/statamic-notifications 适用场景与选型建议

yourcreativepeople/statamic-notifications 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 01 月 19 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 yourcreativepeople/statamic-notifications 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 yourcreativepeople/statamic-notifications 我们能提供哪些服务?
定制开发 / 二次开发

基于 yourcreativepeople/statamic-notifications 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: proprietary
  • 更新时间: 2026-01-19