secit-pl/signal-notifier-bundle
Composer 安装命令:
composer require secit-pl/signal-notifier-bundle
包简介
Symfony Notifier Signal support.
README 文档
README
Signal support for Symfony Notifier 5.1+.
This bundle wraps signal-cli into symfony notifier transport. To make it work you need to have possibility to execute signal-cli command.
Installation
From the command line run
$ composer require secit-pl/signal-notifier-bundle
Configuration
First of all you should have properly set up the signal-cli. If it's working you are ready to proceed.
config/packages/notifier.yaml
framework: notifier: texter_transports: signal: '%env(SIGNAL_DSN)%' # add Signal support channel_policy: urgent: ['sms/signal'] # setup it for specified channel high: ['email'] medium: ['email'] low: ['email']
.env
Configure the Signal DSN using the following format:
SIGNAL_DSN=signal://localhost?cli=SIGNAL_CLI_PATH&user=USER_NAME
Remember to properly encode the phone number. The + sign should be encoded as %2b so the number +481234567890 should be written as %2b481234567890!
For example:
SIGNAL_DSN=signal://localhost?cli=/usr/local/Cellar/signal-cli/0.6.8/bin/signal-cli&user=%2b48123456789
Usage
You can now send the signal messages using Symfony Notifier.
If you'd like to send the message directly using Singal transport you can do it as follows:
<?php declare(strict_types=1); namespace App\Controller; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Notifier\Message\SmsMessage; use Symfony\Component\Notifier\TexterInterface; use Symfony\Component\Routing\Annotation\Route; class IndexController extends AbstractController { /** * @Route("/") */ public function index(TexterInterface $texter) { $texter->send((new SmsMessage( '+481234567890', 'Hello :)' ))->transport('signal')); // ... } }
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-07-14