Skip to content

neolikotsi/php-smsportal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP-SmsPortal

SMS Portal API for PHP

Send SMS from your PHP client API powered by SMSPortal.

Installation

Install the composer package neolikotsi/php-smsportal

composer required neolikotsi/php-smsportal

Usage

Create an instance of NeoLikotsi\SMSPortal\RestClient and use it to hit the endpoints of the SMSPortal RESTful API

use NeoLikotsi\SMSPortal\Message;
use NeoLikotsi\SMSPortal\RestClient;

$apiId = 'YOUR CLIENT API ID';
$apiSecret = 'YOUR CLIENT SECRET';
$baseRestUri = 'https://rest.smsportal.com/v1/';

$client = new RestClient($apiId, $apiSecret, $baseRestUri);
$message = new Message('Hello World');

// send to /bulkmessages endpoint
$responseArray1 = $client->message()->send([
                    'messages' => [
                        [
                            'destination' => '1234567890'
                            'content' => $message->getContent(),
                        ]
                    ]
                ]);

// send to /groupmessages endpoint
$responseArray2 = $client->message()->sendToGroup([
                    'message' => $message->getContent(),
                    'groups' => ['BloemfonteinStores', 'BotshabeloStores'],
                ]);

Balance

You can check your SMS credit with the balance method.

$client->balance();

Test Mode (see api doc)

$client->message()->inTestMode()->send([
    'messages' => [
        [
            'destination' => '1234567890'
            'content' => $message->getContent(),
        ]
    ]
]);

For Laravel users see package

neolikotsi/laravel-smsportal

License

The MIT License (MIT). Please see License File for more information.

Sponsor

₿ BTC Wallet: 18YGRct3jRxkRyxsHG5ByLCkUef7MdXNMw