esendex/sdk
PHP 8.3+ SDK for Esendex SMS messaging. Install via Composer and authenticate with your account to send SMS and retrieve inbox messages. Includes dispatch and inbox services, uses cURL, and supports autoloading via Composer or bundled loader.
The esendex-php-sdk is available to install through several methods as well as from source.
{
"require": {
"esendex/sdk": "3.*.*"
}
}
Composer is not included within the repository, so you will need to retrieve it using the following command:
curl -sS https://getcomposer.org/installer | php
For installation on other platforms see getcomposer.org
We're in the default Packagist repository so just run
$ php composer.phar require esendex/sdk:3.*.*
or add the package above to your composer.json
Then just include Composer's generated autoload.php somewhere in your code;
require_once 'path/to/vendor/autoload.php';
Download the current version here
Our autoloader may be included somewhere in your application;
require_once 'path/to/downloaded/sdk/src/Esendex/AutoLoad.php';
$message = new \Esendex\Model\DispatchMessage(
"WebApp", // Send from
"01234567890", // Send to any valid number
"My Web App is SMS enabled!",
\Esendex\Model\Message::SmsType
);
$authentication = new \Esendex\Authentication\LoginAuthentication(
"EX000000", // Your Esendex Account Reference
"user@example.com", // Your login email address
"password" // Your password
);
$service = new \Esendex\DispatchService($authentication);
$result = $service->send($message);
print $result->id();
print $result->uri();
$authentication = new \Esendex\Authentication\LoginAuthentication(
"EX000000", // Your Esendex Account Reference
"user@example.com", // Your login email address
"password" // Your password
);
$service = new \Esendex\InboxService($authentication);
$result = $service->latest();
print "Total Inbox Messages: {$result->totalCount()}";
print "Fetched: {$result->count()}";
foreach ($result as $message) {
print "Message from: {$message->originator()}, {$message->summary()}";
}
$authentication = new \Esendex\Authentication\LoginAuthentication(
"EX000000", // Your Esendex account reference
"user@example.com", // Your login email
"password" // Your password
);
$headerService = new \Esendex\MessageHeaderService($authentication);
$message = $headerService->message("messageId");
print_r($message->status());
$messageId = "unique-id-of-message";
$authentication = new \Esendex\Authentication\LoginAuthentication(
"EX000000", // Your Esendex Account Reference
"user@example.com", // Your login email address
"password" // Your password
);
$service = new \Esendex\MessageBodyService($authentication);
$result = $service->getMessageBodyById($messageId);
print $result;
Full REST API documentation can be found @ developers.esendex.com
You will need to install composer in order to acquire the pre-requisites. This can be achieved by the following command:
$ curl -sS https://getcomposer.org/installer | php
To retrieve said pre-requisites execute the following:
$ composer.phar install
A suite of tests can be found in the test directory. To run them use the phing build utility. e.g.
$ php vendor/bin/phing
You can check your account credentials using a phing task we have provided. First, ensure dependencies have been installed with composer:
$ composer.phar install
Run the check-access script:
$ vendor/bin/phing check-access
Buildfile: /home/developer/esendex-php-sdk/build.xml
EsendexSDK > check-access:
Esendex Username ? user@example.com
Esendex Password ? secret
Account Reference? EX000000
Account credentials OK!
BUILD FINISHED
Total time: 10.0000 seconds
We hope you don't run into any issues but if you should please make use of the issue tracker on github or send an email to support@esendex.com
Let us know what you think @esendex
How can I help you explore Laravel packages today?