anklimsk/cakephp-notify

使用任务队列发送电子邮件并使用WEB Notifications API从CakePHP 2.x向用户发送通知

安装: 32

依赖: 0

建议者: 0

安全: 0

星星: 1

观察者: 1

分支: 0

开放问题: 0

类型:cakephp-plugin

v1.0.1 2018-11-19 10:40 UTC

This package is auto-updated.

Last update: 2024-09-29 05:02:07 UTC


README

Build Status Coverage Status Latest Stable Version License

使用任务队列从CakePHP发送电子邮件并使用WEB Notifications API向用户发送通知

此插件提供以下功能:

  • 使用任务队列从CakePHP发送电子邮件;
  • 使用Twitter Bootstrap的内联CSS样式;
  • 使用WEB Notifications API通过ID或角色向用户发送通知。

安装

  1. 使用composer安装插件:composer require anklimsk/cakephp-notify

  2. 将以下行添加到文件末尾 app/Config/bootstrap.php

    CakePlugin::load('CakeNotify', ['bootstrap' => true, 'routes' => true]);
  3. app/Plugin/CakeNotify/Config/email.php.default复制配置文件到app/Config/email.php

  4. 在您的布局中添加JavaScript文件

    echo $this->Html->script('CakeNotify.WebNotifications.min.js');
    
    // Add jQuery plugin Server-Sent Events
    echo $this->Html->script('CakeNotify.jquery.sse.min.js');
    
    // If need use store configuration of plugin in storages, include file:
    echo $this->Html->script('CakeNotify.js.storage.min.js');
  5. 获取运行web服务器的用户名,运行以下命令:ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1

  6. 配置脚本以运行计划任务,运行命令 crontab -u www-data -e,其中www-data是web服务器的用户名。

  7. 将以下行添加到cron作业列表中

    #
    # In this example, run the cleanup script expired notifications 
    #  will be made every day on 6:00 AM 
    0 6 * * * cd /var/www/paht_to_app/app && Console/cake CakeNotify.cron clear -q
    

使用

使用此插件