atc/alert-bundle

Symfony AlertBundle

安装次数: 400

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 5

分支: 0

开放问题: 1

类型:symfony-bundle

1.0.5 2016-09-19 05:24 UTC

This package is not auto-updated.

Last update: 2024-09-15 01:50:48 UTC


README

接下来做什么?

此包提供启动短信或电子邮件消息的服务。对于短信,它使用类似Nexmo提供的API。

未来将有什么?

此包旨在提供一个预编程的警报系统,可以通过cron运行。

安装

步骤 1: 下载包

打开命令控制台,进入您的项目目录,并执行以下命令以下载此包的最新稳定版本

$ composer require atc/alert-bundle "~1"

此命令要求您全局安装了Composer,如Composer文档的安装章节所述。

步骤 2: 启用包

然后,通过将其添加到项目app/AppKernel.php文件中注册的包列表中来启用包

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new Atc\Bundle\AlertBundle\AtcAlertBundle(),
        );

        // ...
    }

    // ...
}

配置

atc_alert:
    mail_from_default : "default@default.fr"
    sms_from_default : "0102030405"
    sms_url : "https://rest.nexmo.com/sms/json"
    sms_key : "apiKey"
    sms_secret : "apiSecret"
    mailjet_public : "mailjetApikeyOrNulToUseShiftmail"
    mailjet_private : "mailjetApikeyOrNulToUseShiftmail"

使用它

<?php

$this->get('atc_alert.alert.manager')->createMailAlert(
        $email(),
        $this->renderView('::_email.html.twig', array('foo' => $bar)),
        $sujet,
        $from = null,
        $date = null
);

$this->get('atc_alert.alert.manager')->createSmsAlert($to, $body, $from = null, $date = null);

$this->get('atc_alert.alert.manager')->createSmsMailAlert($toSms, $toMail, $body, $subject, $from = null, $date = null);