amorvan/aws-sns-push-bundle
Composer 安装命令:
composer require amorvan/aws-sns-push-bundle
包简介
A bundle to configure and send push notification with AWS SNS
README 文档
README
The purpose of this bundle is manage mobile push notification with AWS Sns service. Bundle provides many services to following :
- Subscribe device to broadcast topic
- Create a temporary topic
- Subscribe device to specific temp topic
- Unsubscribe device from broadcast or specific topic
- Send mobile push notification with custom message & additional parameters
Prerequisites
This bundles requires Symfony 3.4+ or 4.3+.
Installation
Step 1 - Download the Bundle
composer require amorvan/aws-sns-push-bundle
Step 2 - Enable Bundles (Amorvan/AWSSnsPushBundle & AWS SDK)
Symfony 3 Version :
Register bundle into app/AppKernel.php:
<?php
// app/AppKernel.php
// ...
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
new Aws\Symfony\AwsBundle(),
new Amorvan\AwsSnsPushBundle\AmorvanAwsSnsPushBundle(),
);
}
// ...
}
Symfony 4 version :
Register bundle into config/bundles.php:
return [
//...
Aws\Symfony\AwsBundle::class => ['all' => true],
Amorvan\AwsSnsPushBundle\AmorvanAwsSnsPushBundle::class => ['all' => true],
];
Step 3 - Create entity Device and LogHistoricPush
//Device entity
<?php
namespace YOUR_NAME_SPACE_ENTITY;
use Amorvan\AwsSnsPushBundle\Model\AbstractDeviceModel;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* Class Device
*
* @ORM\Table(name="YOUR_TABLE_NAME")
* @ORM\Entity()
*/
class Device extends AbstractDeviceModel
{
/**
* @var string
*
* @ORM\Column(type="string")
* @ORM\Id()
*/
protected $id;
/**
* @var DateTime
*
* @ORM\Column(type="datetime")
*/
protected $createdAt;
/**
* @var string
*
* @ORM\Column(type="string")
*/
protected $deviceType;
/**
* @var string
*
* @ORM\Column(type="string")
*/
protected $deviceId;
/**
* @var UserInterface|null
*
* @ORM\ManyToOne(targetEntity="FQCN_ENTITY_USER")
* @ORM\JoinColumn(name="FK_NAME", referencedColumnName="id", nullable=true)
*/
protected $user;
}
//LogHistoricPush entity
<?php
namespace YOUR_NAME_SPACE_ENTITY;
use Amorvan\AwsSnsPushBundle\Model\AbstractLogHistoricPush;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
/**
* Class LogHistoricPush
*
* @ORM\Table(name="amo_log_historic_push")
* @ORM\Entity()
*/
class LogHistoricPush extends AbstractLogHistoricPush
{
/**
* @var string
*
* @ORM\Column(type="string")
* @ORM\Id()
*/
protected $id;
/**
* @var DateTime
*
* @ORM\Column(type="datetime")
*/
protected $createdAt;
/**
* @var string
*
* @ORM\Column(type="string")
*/
protected $type;
/**
* @var string
*
* @ORM\Column(type="text")
*/
protected $message;
/**
* @var int
*
* @ORM\Column(type="integer")
*/
protected $pushsNumber;
/**
* @var string
*
* @ORM\Column(type="string")
*/
protected $topicArn;
}
Step 4 - Update database Schema
Use Doctrine schema update
bin/console doctrine:schema:update --force
Use Migrations Doctrine
bin/console doctrine:migrations:diff
bin/console doctrine:migrations:migrate
Step 5 - Configure Bundle
amorvan/aws-sns-push-bundle 适用场景与选型建议
amorvan/aws-sns-push-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 10 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 amorvan/aws-sns-push-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 amorvan/aws-sns-push-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-10-04