Skip to content

colesnic89/smso

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SMSO API

SMSO API PHP implementation

Welcome to the SMSO API! You can use this package to access SMSO API endpoints.

Authentication

SMSO uses API keys to allow access to the API. You can register a new SMSO API key at their developer page.

Installation

composer require colesnic89/smso

Usage

<?php

use SMSO\ApiClient;

// initialize ApiClient
$apiClient = new ApiClient('your-api-token-here');

// get list senders
$smsSenders = $apiClient->getSenders();

foreach ($smsSenders as $sender) {
    echo $sender->getId();
    echo $sender->getName();
    echo $sender->getPricePerMessage();
}

// send SMS message
$sendMessageResponse = $apiClient->sendMessage('+40123456789', 'Message text', $smsSenders[0]->getId());

echo $sendMessageResponse->getStatus();
echo $sendMessageResponse->getResponseToken();

// check message status
$checkStatusResponse = $apiClient->checkMessageStatus($sendMessageResponse->getResponseToken());

echo $checkStatusResponse->getStatus();
echo $checkStatusResponse->getData()->getStatus();
echo $checkStatusResponse->getData()->getSentAt();
echo $checkStatusResponse->getData()->getDeliveredAt();
echo $checkStatusResponse->getData()->getReceiver()->getNumber();
echo $checkStatusResponse->getData()->getReceiver()->getMcc();
echo $checkStatusResponse->getData()->getReceiver()->getMnc();

// check remaining credit
$checkRemainingCreditResponse = $apiClient->checkRemainingCredit();

echo $checkRemainingCreditResponse->getStatus();
echo $checkRemainingCreditResponse->getCreditValue();

About

SMSO API PHP implementation

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages