symfony/sweego-notifier 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

symfony/sweego-notifier

最新稳定版本:v8.1.0-BETA1

Composer 安装命令:

composer require symfony/sweego-notifier

包简介

Symfony Sweego Notifier Bridge

README 文档

README

Provides Sweego integration for Symfony Notifier.

DSN example

SWEEGO_DSN=sweego://API_KEY@default?region=REGION&campaign_type=CAMPAIGN_TYPE&bat=BAT&campaign_id=CAMPAIGN_ID&shorten_urls=SHORTEN_URLS&shorten_with_protocol=SHORTEN_WITH_PROTOCOL

where:

  • API_KEY (required) is your Sweego API key
  • REGION (required) is the region of the phone number (e.g. FR, ISO 3166-1 alpha-2 country code)
  • CAMPAIGN_TYPE (required) is the type of the campaign (e.g. transac)
  • BAT (optional) is the test mode (e.g. true)
  • CAMPAIGN_ID (optional) is the campaign id (e.g. string)
  • SHORTEN_URLS (optional) is the shorten urls option (e.g. true)
  • SHORTEN_WITH_PROTOCOL (optional) is the shorten with protocol option (e.g. true)

Advanced Message options

use Symfony\Component\Notifier\Message\SmsMessage;
use Symfony\Component\Notifier\Bridge\Sweego\SweegoOptions;

$sms = new SmsMessage('+1411111111', 'My message');

$options = (new SweegoOptions())
    // False by default, set 'bat' to true enable test mode (no sms sent, only for testing purpose)
    ->bat(true)
    // Optional, used for tracking / filtering purpose on our platform; identity an SMS campaign and allow to see logs / stats only for this campaign
    ->campaignId('string')
    // True by default, we replace all url in the SMS content by a shortened url version (reduce the characters of the sms)
    ->shortenUrls(true)
    // True by default, add scheme to shortened url version
    ->shortenWithProtocol(true);

// Add the custom options to the sms message and send the message
$sms->options($options);

$texter->send($sms);

Webhook

Configure the webhook routing:

framework:
    webhook:
        routing:
            sweego_sms:
                service: notifier.webhook.request_parser.sweego
                secret: '%env(SWEEGO_WEBHOOK_SECRET)%'

And a consumer:

#[AsRemoteEventConsumer(name: 'sweego_sms')]
class SweegoSmsEventConsumer implements ConsumerInterface
{
    public function consume(RemoteEvent|SmsEvent $event): void
    {
        // your code
    }
}

Sponsor

Help Symfony by sponsoring its development!

Resources

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固