You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The class `BulkGate\Sdk\Message\Bulk` represents the object, which connects all types of messages (`BulkGate\Sdk\Message\Sms`, `BulkGate\Sdk\Message\Viber`, `BulkGate\Sdk\Message\MultiChannel`) to a bulk message (campaign).
4
5
5
6
```php
6
-
$sms_message = new Sms('420777777777', new SimpleText("test <variable>", ["variable" => "message"]));
7
+
use BulkGate\Sdk\Message\{Sms, Viber, MultiChannel, Bulk};
8
+
use BulkGate\Sdk\Message\Component\{SimpleText, Button}
9
+
```
10
+
11
+
```php
12
+
$sms_message = new Sms('420777777777', new SimpleText('test <variable>', ['variable' => 'message']));
7
13
8
14
$viber_message = new Viber(
9
15
'420777777777',
10
-
new SimpleText("test <variable>", ["variable" => "message"]),
11
-
"Sender",
12
-
new Button("Caption", "https://www.bulkgate.com/")
16
+
new SimpleText('test <variable>', ['variable' => 'message']),
17
+
'Sender',
18
+
new Button('Caption', 'https://www.bulkgate.com/')
13
19
);
14
20
15
21
$multi_channel_message = new MultiChannel($phone_number);
Schedulers are classes that allow scheduling messages at certain intervals or in particular times.
4
5
5
6
## Simple scheduler
6
7
7
-
Simple scheduler for sending messages at particular time
8
+
Simple scheduler for sending messages at particular time.
8
9
9
10
```php
10
-
$scheduler = new Simple(new \DateTime());
11
+
$scheduler = new Simple(new DateTime('2025-12-13 12:00'));
12
+
11
13
$scheduler->schedule($message);
12
14
```
13
15
14
16
## Campaign
15
17
16
-
Campaign scheduler allows you to start sending messages from particular time by at defined intervals. You can also define how many planned messages will be send out after certain interval.
18
+
Campaign scheduler allows you to start sending messages from particular time by at defined intervals. You can also define how many planned messages will be sent out after certain interval.
17
19
18
20
```php
19
-
$scheduler = new Campaign(new \DateTime());
20
-
$scheduler->restriction(2, 2, "hours");
21
+
$scheduler = new Campaign(new DateTime('2025-12-13 12:00'));
The easiest way to install [bulkgate/php-sdk](https://packagist.org/packages/bulkgate/php-sdk) into a project is by using [Composer](https://getcomposer.org/) via the command line.
If you have the package installed just plug in the autoloader.
21
14
22
-
```php
15
+
```php
23
16
require_once __DIR__ . '/vendor/autoload.php';
24
17
```
25
18
19
+
```php
20
+
use BulkGate\Sdk\Connection\ConnectionStream;
21
+
use BulkGate\Sdk\MessageSender;
22
+
use BulkGate\Sdk\Scheduler\Simple;
23
+
use BulkGate\Sdk\Configurator\ViberConfigurator;
24
+
```
25
+
26
+
26
27
In order to send messages, you need an instance of the `BulkGate\Sdk\MessageSender` class that requires instance dependency on the `BulkGate\Sdk\Connection\Connection` class. See how to get API access data.
27
28
28
-
```php
29
-
$connection = new BulkGate\Sdk\Connection\ConnectionStream('APPLICATION_ID', 'APPLICATION_TOKEN');
29
+
```php
30
+
$connection = new ConnectionStream(/*application_id: */ 0000, /*application_token:*/ 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
30
31
31
-
$sender = new BulkGate\Sdk\MessageSender($connection);
32
+
$sender = new MessageSender($connection);
32
33
```
33
34
34
35
At this point, you are ready to send a message.
35
36
36
-
```php
37
-
$message = new Sms("420603902776", "test_text");
37
+
```php
38
+
$message = new Sms('420603902776', 'test_text');
39
+
40
+
$sender->send($message);
38
41
```
39
42
40
43
The `send()` method will send a message `$message`.
41
44
42
-
## Nette instalation
45
+
### Optional configuration
46
+
47
+
```php
48
+
$sender->setTag('your identificator');
49
+
```
50
+
51
+
If you want to use national phone numbers you must set default country.
52
+
```php
53
+
$sender->setDefaultCountry('sk');
54
+
```
55
+
56
+
You can add [configurators](configurators.md) to sender.
57
+
58
+
```php
59
+
$viber_configurator = new ViberConfigurator('Sender');
0 commit comments