Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 457f0b0

Browse files
committed
feature #53148 [Notifier] Add Smsbox notifier bridge (Alan ZARLI)
This PR was merged into the 7.1 branch. Discussion ---------- [Notifier] Add Smsbox notifier bridge | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | no | New feature? | yes | Deprecations? | no | Issues | - | License | MIT Commits ------- 5675c95 [Notifier] Add Smsbox notifier bridge
2 parents 4e0ff10 + 5675c95 commit 457f0b0

18 files changed

+1137
-0
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2750,6 +2750,7 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
27502750
NotifierBridge\Sms77\Sms77TransportFactory::class => 'notifier.transport_factory.sms77',
27512751
NotifierBridge\Smsapi\SmsapiTransportFactory::class => 'notifier.transport_factory.smsapi',
27522752
NotifierBridge\SmsBiuras\SmsBiurasTransportFactory::class => 'notifier.transport_factory.sms-biuras',
2753+
NotifierBridge\Smsbox\SmsboxTransportFactory::class => 'notifier.transport_factory.smsbox',
27532754
NotifierBridge\Smsc\SmscTransportFactory::class => 'notifier.transport_factory.smsc',
27542755
NotifierBridge\SmsFactor\SmsFactorTransportFactory::class => 'notifier.transport_factory.sms-factor',
27552756
NotifierBridge\Smsmode\SmsmodeTransportFactory::class => 'notifier.transport_factory.smsmode',

src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@
188188
->parent('notifier.transport_factory.abstract')
189189
->tag('texter.transport_factory')
190190

191+
->set('notifier.transport_factory.smsbox', Bridge\Smsbox\SmsboxTransportFactory::class)
192+
->parent('notifier.transport_factory.abstract')
193+
->tag('texter.transport_factory')
194+
191195
->set('notifier.transport_factory.smsc', Bridge\Smsc\SmscTransportFactory::class)
192196
->parent('notifier.transport_factory.abstract')
193197
->tag('texter.transport_factory')
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/Tests export-ignore
2+
/phpunit.xml.dist export-ignore
3+
/.gitattributes export-ignore
4+
/.gitignore export-ignore
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
vendor/
2+
composer.lock
3+
phpunit.xml
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CHANGELOG
2+
=========
3+
4+
7.1
5+
---
6+
7+
* Add the bridge
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2023-present Fabien Potencier
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is furnished
8+
to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
SMSBOX Notifier
2+
---------------
3+
4+
Provides [SMSBOX](https://www.smsbox.net/en/) integration for Symfony Notifier.
5+
6+
DSN example
7+
-----------
8+
9+
```
10+
SMSBOX_DSN=smsbox://APIKEY@default?mode=MODE&strategy=STRATEGY&sender=SENDER
11+
```
12+
13+
where:
14+
15+
- `APIKEY` is your SMSBOX api key
16+
- `MODE` is the sending mode
17+
- `STRATEGY` is the type of your message
18+
- `SENDER` is the sender name
19+
20+
## You can add numerous options to a message
21+
22+
With a SMSBOX Message, you can use the SmsboxOptions class and use the setters to add [message options](https://www.smsbox.net/en/tools-development#developer-space)
23+
24+
```php
25+
use Symfony\Component\Notifier\Message\SmsMessage;
26+
use Symfony\Component\Notifier\Bridge\Smsbox\SmsboxOptions;
27+
28+
$sms = new SmsMessage('+33123456789', 'Your %1% message %2%');
29+
$options = (new SmsboxOptions())
30+
->mode(SmsboxOptions::MESSAGE_MODE_EXPERT)
31+
->strategy(SmsboxOptions::MESSAGE_STRATEGY_NOT_MARKETING_GROUP)
32+
->sender('Your sender')
33+
->date('DD/MM/YYYY')
34+
->hour('HH:MM')
35+
->coding(SmsboxOptions::MESSAGE_CODING_UNICODE)
36+
->charset(SmsboxOptions::MESSAGE_CHARSET_UTF8)
37+
->udh(SmsboxOptions::MESSAGE_UDH_DISABLED_CONCAT)
38+
->callback(true)
39+
->allowVocal(true)
40+
->maxParts(2)
41+
->validity(100)
42+
->daysMinMax(min: SmsboxOptions::MESSAGE_DAYS_TUESDAY, max: SmsboxOptions::MESSAGE_DAYS_FRIDAY)
43+
->hoursMinMax(min: 8, max: 10)
44+
->variable(['variable1', 'variable2'])
45+
->dateTime(new \DateTime())
46+
->destIso('FR');
47+
48+
$sms->options($options);
49+
$texter->send($sms);
50+
```

0 commit comments

Comments
 (0)