PHP code example of kimulisiraj / sms-speeda-mobile-php
1. Go to this page and download the library: Download kimulisiraj/sms-speeda-mobile-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kimulisiraj / sms-speeda-mobile-php example snippets
use Kimulisiraj\SmsSpeedaMobile\SmsSpeedaMobile;
$client = new SmsSpeedaMobile(
apiKey: 'your-username',
apiSecret: 'your-password',
);
$response = $client->send(
to: '256781234567',
message: 'Hello, Kimulisiraj!',
);
$response->getStatus(); // OK | FAILED
$response->getMessage(); // Message sent successfully
$response->hasError(); // true | false
$response->getError(); // the failure reason, or null
$response->getMessageId(); // I.E 12345
use Kimulisiraj\SmsSpeedaMobile\SmsSpeedaMobile;
$client = SmsSpeedaMobile::config(
apiKey: 'your-api-key', // e.g. env('SPEEDAMOBILE_SMS_API_ID')
apiPassword: 'your-api-password', // e.g. env('SPEEDAMOBILE_SMS_API_PASSWORD')
);
$response = $client->message('Hello, Kimulisiraj!')
->to('256781234567')
->send();
use Kimulisiraj\SmsSpeedaMobile\SmsSpeedaMobile;
$client = new SmsSpeedaMobile(
apiKey: 'your-username',
apiSecret: 'your-password',
);
$response = $client->messageStatus(
messageId: '4234', // Message ID you received at the time of submit
);
$response->getMessageId(); // string Message ID of the request
$response->getPhoneNumber(); // string Phone number the message was sent to
$response->getMessageBody(); // string Text of the SMS message
$response->getMessageType(); // string Message encoding
$response->getMessageLength(); // int Length of the message
$response->getMessageParts(); // int Number of message parts
$response->getMessageCost(); // float Amount deducted from the account
$response->getDeliveryStatus(); // string Pending, Delivered, Undeliverable, Acknowledged, Expired, Accepted, Rejected, Unknown, Failed or DND
$response->getUniqueId(); // string Carrier generated SMS ID
$response->getErrorCode(); // ?string Error code, if any
$response->getErrorDescription(); // ?string Error description, if any
$response->getSentDateTime(); // ?string Sent date in UTC, formatted as Y-m-d H:i:s
$response->getRemarks(); // ?string Remarks for the request
use Kimulisiraj\SmsSpeedaMobile\SmsSpeedaMobile;
$client = new SmsSpeedaMobile(
apiKey: 'your-username',
apiSecret: 'your-password',
);
$client->getBalance(); // ['BalanceAmount' => 1000, 'CurrenceCode' => 'UGX']
use GuzzleHttp\Client as GuzzleClient;
use Kimulisiraj\SmsSpeedaMobile\Api\Client;
$client = new Client(
new GuzzleClient(),
'your-username',
'your-password',
baseUri: 'https://apidocs.speedamobile.com/api/',
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.