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
$client = new \Kimulisiraj\SmsSpeedaMobile\SmsSpeedaMobile(
apiKey:"your-username",
apiSecret: "your-password",
);
$response = $client->send(
to: 2567xxxxxxxx,
mesage:'Hello, Kimulisiraj!'
)
return $response;
$response->getStatus(); // OK | FAILED
$response->getMessage(); // Message sent successfully
$response->hasError(); // true | false
$response->getMessageId(); // I.E 12345
$client = Kimulisiraj\SmsSpeedaMobile::config([
'apiKey' => 'your-api-key', //You can set and use env('SPEEDAMOBILE_SMS_API_ID')
'apiPassword' => 'your-api-password', ////You can set and use env('SPEEDAMOBILE_SMS_API_PASSWORD')
]);
$response = $client->mesage('Hello, Kimulisiraj!')
->to('2567xxxxxxxx')
->send();
return $response
$client = new \Kimulisiraj\SmsSpeedaMobile\SmsSpeedaMobile(
apiKey:"your-username",
apiSecret: "your-password"
);
$response = $client->messageStatus(
messageId: 'xxxxxxx' //Message ID You Received at The Time of Submit E.G 4234
);
return response()->json([
'messageId' => $response->getMessageId(),
'phoneNumber' => $response->getPhoneNumber(),
'messageBody' => $response->getMessageBody(),
'MessageType' => $response->getMessageType(),
'messageLength' => $response->getMessageLength(),
'messageParts' => $response->getMessageParts(),
'messageCost' => $response->getMessageCost(),
'deliveryStatus' => $response->getDeliveryStatus(),
'uniqueId' => $response->getUniqueId(),
'errorCode' => $response->getErrorCode(),
'errorDescription' => $response->getErrorDescription(),
'sentDateTime' => $response->getSentDateTime(),
'remarks' => $response->getRemarks(),
]);
$response->getMessageId(), // Message ID of the request
$response->getPhoneNumber(), // Phone Number to which message was sent
$response->getMessageBody(), // Text of the SMS message
$response->getMessageType(), // Message Encoding
$response->getMessageLength(), // Length of Message
$response->getMessageParts(), // No of Message parts
$response->getMessageCost(), // Amount Deducted from account
$response->getDeliveryStatus(), // Delivery Status Can Be One Of the following (Pending, Delivered, Undeliverable, Acknowledged, Expired, Accepted, Rejected, Unknown, Failed, DND)
$response->getUniqueId(), // Carrier Generated SMS ID
$response->getErrorCode(), // Error Code If Any
$response->getErrorDescription(), // Error Description If Any
$response->getSentDateTime(), // SMS Sent Date Time in UTC (Universal TimeCoordinate)
$response->getRemarks(), // Remarks for the Request