relief_applications / notifications-bundle

此包已被弃用,不再维护。未建议替代包。

用于从服务器发送通知的包。

安装: 92

依赖: 0

建议者: 0

安全: 0

星标: 0

关注者: 0

分支: 0

开放问题: 0

类型:symfony-bundle

1.0.1 2018-07-25 08:24 UTC

This package is not auto-updated.

Last update: 2021-01-23 09:13:32 UTC


README

安装

步骤 1:下载包

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

$ composer require relief_applications/notifications-bundle

步骤 2:启用包

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

<?php
// app/AppKernel.php

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

            new RA\NotificationsBundle\RANotificationsBundle(),
        );

        // ...
    }

    // ...
}

### 步骤 3:配置包

在您的项目中,在文件 app/config/config.yml 的末尾添加以下配置

ra_notifications:
    android:
        server_key: "%android_server_key%"
        fcm_server: "%android_fcm_server%"
    ios:
        push_passphrase: '%ios_push_passphrase%'
        push_certificate: 'null'
        apns_server: '%ios_apns_server%'
    device:
        class: YourBundle\Entity\Device
    contexts:
        ctx_1:
            ios:
                push_certificate: /var/ioskeys/crises.pem
                apns_topic: topic_name1
        ctx_2:
            ios:
                push_certificate: /var/ioskeys/americas.pem
                apns_topic: topic_name2

可选(但推荐)

为了提高iOS通知的错误管理,您需要在机器上对cURL启用http2支持。查看此教程。

一旦您完成了此教程,请通过以下命令检查cURL是否支持HTTP/2:

$ curl --http2 -I https://nghttp2.org/

如果工作正常,您可以从您的 app/config/config.yml 文件中删除以下行:

            protocol: legacy