Installation
Composer
The easiest way to install bulkgate/php-sdk into a project is by using Composer via the command line.
If you have the package installed just plug in the autoloader.
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.
At this point, you are ready to send a message.
The send() method will send a message $message.
The result of sending
The send() method returns the same message with its status filled in. You read
the result from the public properties:
For a bulk message the status is filled in for each message separately — walk it
with a foreach loop.
Handling errors
Sending can end with an exception. All of them extend
BulkGate\Sdk\SdkException:
| Exception | When it happens |
|---|---|
ConnectionException |
The API could not be reached |
ApiException |
The API returned an error (invalid credentials, for instance) |
SenderException |
An unknown message type was passed to the sender |
InvalidStateException |
An invalid value — a country ISO code or a scheduler unit, say |
ChannelException |
An error in the channel setup of a multichannel message |
Optional configuration
If you want to use national phone numbers you must set default country.
You can add configurators to sender.
For scheduling you can add instance of BulkGate\Sdk\Scheduler\Scheduler.
Thank you for your feedback.