PHP Helper Library for World Text SMS Text Messaging
You can install World-Text-PHP by downloading the source.
Once you have downloaded the library, put the World-Text-PHP folder into your project hierarchy and then include the library file:
require_once('/path/World-Text-PHP/WorldText.php');
[Click here to download a ZIP of the source] (https://github.com/m-r-h/World-Text-PHP/zipball/master) which includes all dependencies.
World Text SMS API is documented here: World Text HTTP REST API
PHP Helper Library Documentation is here: World Text PHP Helper Class
With the World-Text-PHP library, we've encapsulated our API into a number of objects. You don't need to be directly concerned with the API calls, or URLs, or parsing the JSON responses.
The classes are as follows:
- WorldText - The base class, containing the API calls and response processing
- WorldTextAdmin - container for admin methods
- WorldTextSms - Derived from WorldText and the container for sms methods
- WorldTextGroup - Derived from WorldText and the container for group methods. Pre-populated with a group from your account on our servers and minimises calls to the API in the process.
- wtException - adds a couple of methods for additional codes to the Exception class
See the World Text PHP Class Guide to get the details on the classes and methods, and how to get started with World-Text-PHP
<?php
require_once('/path/World-Text-PHP/WorldText.php');
// Replace id and apiKey with values from http://www.world-text.com/account/
// ...and the mobile number with a valid one in international format
$id = "XXXXXX"; // Your Account ID
$apiKey = "XXXXXX"; // Your secret API Key
$sms = WorldTextSms::CreateSmsInstance(id, apiKey);
try {
$info = $sms->send("447989000000", "Example message");
} catch (wtException $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
?>
Full Documentation for World-Text-PHP is on our site, along with detailed API documentation and other libraries and languages.
- PHP >= 5.2.3
We would love to hear your ideas and feedback, or if you've added to, or modified this library. Report issues using Github Issue Tracker or email [email protected].