|
1 | 1 |
|
2 |
| -# symfony-sms-interface |
| 2 | +# scaytrase/symfony-sms-delivery-bundle |
3 | 3 | [](https://packagist.org/packages/scaytrase/symfony-sms-interface) [](https://packagist.org/packages/scaytrase/symfony-sms-interface) [](https://packagist.org/packages/scaytrase/symfony-sms-interface) [](https://packagist.org/packages/scaytrase/symfony-sms-interface)
|
4 | 4 |
|
5 | 5 | [](https://packagist.org/packages/scaytrase/symfony-sms-interface)
|
6 | 6 | [](https://packagist.org/packages/scaytrase/symfony-sms-interface)
|
7 | 7 |
|
8 |
| -This Symfony2 bundle provides basic interface for sending short messages as a service |
| 8 | +This Symfony2 bundle provides basic service for sending short messages. This bundle does not provide you any finished implementation for communicating the SMS gateway. To use it you have use some transport implementation or implemenent a transport on your own. See [usage section](#Usage) for known implementations |
9 | 9 |
|
10 |
| -## Current features |
| 10 | +## Features |
11 | 11 |
|
12 |
| -- Extensible inteface and basic service class |
13 |
| -- Ability to disable delivery via config for testing purposes |
14 |
| -- Ability to force redirect messages for testing purposes |
| 12 | +### Current features |
15 | 13 |
|
| 14 | +- [x] Service and configurable transports |
| 15 | +- [x] Ability to disable delivery via config for testing purposes |
| 16 | +- [x] Ability to force redirect messages for testing purposes |
| 17 | +- [x] Profiling via Sf2 Toolbar |
| 18 | + |
| 19 | +### Planned features |
16 | 20 |
|
17 |
| -## Installation |
18 |
| - |
19 |
| -Installation is available via Composer |
| 21 | +- [ ] Bulk sending |
| 22 | +- [ ] Spooling and delayed sending |
20 | 23 |
|
21 |
| -### composer.json |
| 24 | +## Installation |
22 | 25 |
|
| 26 | +This bunde could be installed via Composer |
23 | 27 |
|
24 | 28 | ```
|
25 |
| -require: "scaytrase/symfony-sms-interface": "~0.2.0" |
| 29 | +composer require scaytrase/symfony-sms-delivery-bundle:~1.0 |
26 | 30 | ```
|
27 | 31 |
|
28 | 32 | ### app/AppKernel.php
|
29 | 33 |
|
30 | 34 | update your kernel bundle requirements as follows:
|
31 | 35 |
|
32 |
| -``` |
| 36 | +```php |
33 | 37 | $bundles = array(
|
34 |
| - .... |
35 |
| - new ScayTrase\Utils\SMSDeliveryBundle\SMSDeliveryBundle(), |
36 |
| - .... |
| 38 | + //.... |
| 39 | + new ScayTrase\SmsDeliveryBundle\SmsDeliveryBundle(), |
| 40 | + //.... |
37 | 41 | );
|
38 | 42 | ```
|
39 | 43 |
|
40 | 44 | ## Configuration
|
41 | 45 |
|
42 |
| -Basic interface supports two optional parameters: |
| 46 | +Below is the configuration example and their default values |
43 | 47 |
|
44 |
| -``` |
| 48 | +```yaml |
45 | 49 | sms_delivery:
|
46 |
| - disable_delivery: true # disables actual delivery making every send return successful result. use profiler to get message details |
| 50 | + transport: sms_delivery.dummy_sender # @id of the transport service |
| 51 | + disable_delivery: false # disables actual delivery making every send return successful result. use profiler to get message details |
47 | 52 | delivery_recipient: null # when not null - sends every message to the specified recipient, ignoring actual recipient of the message.
|
48 | 53 | ```
|
49 | 54 |
|
50 | 55 | ## Usage
|
51 | 56 |
|
52 |
| -To use this interface you must create a message class implementing ``ShortMessageInterface`` and extend abstract MessageDeliveryService with your own delivery api service. As soon as you a ready to go, you must specify sender class via ``sms_delivery.class`` parameter. |
| 57 | +To use this interface you must create a message class implementing ``ShortMessageInterface`` and implement a transport that delivers your message to end point sms gateway. You can refer my [WebSMS](https://github.com/scaytrase/symfony-websms-bundle) gateway implementation as a reference. |
| 58 | + |
53 | 59 |
|
54 |
| - Refer [DummyMessageDeliveryService](src/ScayTrase/Utils/SMSDeliveryBundle/Service/DummySender/DummyMessageDeliveryService.php) as an example. It is also set as a default delivery service for quick start usage. |
55 |
| - |
56 |
| - |
57 | 60 | ### Example
|
58 | 61 |
|
59 |
| -``` |
| 62 | +```php |
60 | 63 | public function sendSmsAction(){
|
61 | 64 | $message = new YourMessage('5552368','Help!')
|
62 |
| - $sender = $this->get('sms_delivery.sender'); |
63 |
| - $result = $sender->send($message); |
| 65 | + $result = $this->get('sms_delivery.sender')->send($message); |
64 | 66 | return new Response('Delivery '. $result ? 'successful' ; 'failed');
|
65 | 67 | }
|
66 |
| -``` |
| 68 | +``` |
0 commit comments