Download the PHP package toucantext/php-sdk without Composer
On this page you can find all versions of the php package toucantext/php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download toucantext/php-sdk
More information about toucantext/php-sdk
Files in toucantext/php-sdk
Package php-sdk
Short Description The ToucanText PHP SDK is a simple to use interface to help you send and retrieve messages quickly and efficiently.
License
Informations about the package php-sdk
ToucanText PHP SDK
This library requires a minimum PHP version of 5.5
This is the PHP SDK library to use ToucanText's API. To use this, you'll need a ToucanText account and have access to your API credentials. Sign up for your free trial at toucantext.com.
- Installation
- Usage
- Examples
- Coverage
Installation
To use the PHP SDK, create a ToucanText account.
To install the PHP client to your project, we recommend using Composer.
You don't need to clone this repository to use the library in your own projects, you can use Composer to install it from Packagist.
If you're new to Composer, here are some resources that you may find useful:
- Composer's Getting Started page from Composer project's documentation
- A Beginner's Guide to Composer from ScotchBox
Instantiating the SDK Client
Pass in the configuration to the client:
Note: If you are unsure what your 'api_username' or 'api_password' are, contact [email protected].
Using the Client
Getting all messages
To return a list of all your messages (both inbound and delivery receipts):
By default, this returns a maximum of 25 messages but does NOT acknowledge them. To override this, pass the following parameters (the first denotes whether to acknowledge messages; the second for the maximum number of messages to return):
Getting inbound messages or delivery receipts only
To return a list of inbound messages or delivery receipts:
By default, this returns a maximum of 25 inbound messages or delivery receipts but does NOT acknowledge them. To override this, pass the following parameters (the second denotes whether to acknowledge messages; the third for the maximum number of messages to return):
Sending a message
To send a message you, can call the following:
You can also set a source address and request a delivery receipt:
Acknowledging delivery receipts and messages
When you retrieve your inbound messages or delivery receipts, there is a MbStorageId element within the response of the query. This ID can be used to acknowledge messages and delivery receipts individually.
To acknowledge a message or delivery receipt create an array with the ID's to acknowledge and then call the following:
Handling Exceptions
Aside from errors that may occur due to the call, there may be other Exceptions thrown. To handle them, wrap your call in a try catch block:
License
This library is released under the MIT License.