grambas/sms-gateway

API container for Laravel 5.2

v1.0 2016-08-29 09:33 UTC

This package is auto-updated.

Last update: 2024-04-13 04:41:13 UTC


README

Basic https://gatewayapi.com/ API Container for Laravel 5.*

Requirements

  • "guzzlehttp/guzzle": "~6.0"

Install

Via Composer

$ composer require grambas/SmsGateway dev-master

Usage

Simple example to send sms

$client = new SmsGateway( 'API KEY','SECRET KEY'); // init client with api key and secret
$response = $client->send('SENDER NAME', '048139381038', 'Message content'); //send sms with paramters: sender name, phone nunbmer and message

if (  isset($response['ids']) ) { // if message is sent, then the system generates id. So if id exist, then the message is successfuly snent
    return "Message successfuly sent!  Cost: " . $response['usage']['total_cost'] . ' ' . $response['usage']['currency'];
}else{
    return 'Error acquired during sending message';
}

Check balance

$client = new SmsGateway( 'API KEY','SECRET KEY');
$check = $client->me();
return 'New balance: ' . $check['credit']  . ' ' . $check['currency'];


License

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