2017 © Pedro Peláez
 

library laravel-sms-api

Send and receive SMS anywhere in the world using our web services

image

tooma/laravel-sms-api

Send and receive SMS anywhere in the world using our web services

  • Thursday, June 15, 2017
  • by Esofts
  • Repository
  • 1 Watchers
  • 0 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Laravel-tooma

Send and receive SMS anywhere in the world using Tooma web services, (*1)

Integrate TOOMA SMS API with Laravel

Laravel package to provide ntegration for TOOMA SMS service, (*2)

Installation

Require this package with composer:, (*3)

composer require tooma/laravel-sms-api

Once the package is added, add the ServiceProvider to the providers array in config/app.php:, (*4)

Tooma\Laravel\Api\Providers\ToomaServiceProvider::class

Once done, publish the config to your config folder using:, (*5)

php artisan vendor:publish --provider="Tooma\Laravel\Api\Providers\ToomaServiceProvider"

Configuration

Once the config file is published, open config/tooma-api.php, (*6)

Edit config

Edit default configuration such as, (*7)

apiKey : Your API key provider by Tooma, (*8)

defaultSSLPath : Default path to ssl certificate if using a different certificate from default one, (*9)

defaultSenderName : Default sender name defaults to TOOMA_SMS (in Kenya), (*10)

Usage

### Retrive ApiKey Once you get your API key, add it to the config/tooma-api.php config file, please note you only run this function once, you can also get your API key by going to tooma.co.ke > settings > api, (*11)

``` app()->tooma->onSuccess(function($response,$pagination){ // Logic when Login is successfull $apiKey = $response->data->token;, (*12)

   })->onError(function($response)
   {
       // Logic on Error 
   })->login(['username'=>'YOUR_USERNAME_OR_EMAIL','password'=>'YOUR_PASSWORD']);

```, (*13)

### Sending Message Sending SMS is as easy as just ``` $parcel=[ ['to'=>'+254XXXXXXXXX','message'=>'Greetings from Tooma'], ...... ]; app()->tooma->onSuccess(function($response,$pagination){ // Logic sending is successfull, (*14)

   })->onError(function($response)
   {
       // Logic on Error 
   })->sendSms($parcel);

```, (*15)

### Sending Bulk Messages Sending multiple message ``` $parcel=[ ['to'=>'+254XXXXXXXXX','message'=>'Dear XXX Greetings from Tooma'], ['to'=>'+254YYYYYYYYY','message'=>'Dear YYY Greetings from Tooma'], ...... ]; app()->tooma->onSuccess(function($response,$pagination){ // Logic sending is successfull, (*16)

   })->onError(function($response)
   {
       // Logic on Error 
   })->sendSms($parcel);

```, (*17)

### Retrive All Messages, (*18)

### Retrieve Message Status, (*19)

### Get account balancce Getting balance just call balance as follows ``` app()->tooma->onSuccess(function($response,$pagination){ // Logic sending is successfull echo "Your balance is $response->data->balance";, (*20)

   })->onError(function($response)
   {
       // Logic on Error 
   })->balance();

```, (*21)

### Send Message from CSV files You can also send message from a csv file as follows ``` $csvPath = "path/to/your/csv.csv";, (*22)

app()->tooma->onSuccess(function($response,$pagination){ // Logic sending is successfull echo "Your balance is $response->data->balance";, (*23)

   })->onError(function($response)
   {
       // Logic on Error 
   })->withCsv($csvPath)
     ->withPhoneColumn('phone') //name of column with phone
     ->withTemplate('Dear :username_column_name your account balance is :balance_column_name')
     ->sendCsv();

```, (*24)

### Working with Message templates You can also send message from a saved or new templat as follows ``` $data = [ ['phone'=>'+254WWWWW','name'=>'','other_args'=>'args_val'];, (*25)

]; app()->tooma->onSuccess(function($response,$pagination){ // Logic sending is successfull echo "Your balance is $response->data->balance";, (*26)

   })->onError(function($response)
   {
       // Logic on Error 
   })->withParams(['args1'=>'val']) //extra parametaer
     ->withTemplate('Dear :name your account balance is :balance_column_name') //or you can pass a template id
     ->sendFromTemplate($data);

```, (*27)

### Schedule Message You can send SMS at a later stage by enableing schedule, the shedule format follows the cron format ``` $parcel=[ ['to'=>'+254XXXXXXXXX','message'=>'Greetings from Tooma'], ...... ]; app()->tooma->onSuccess(function($response,$pagination){ // Logic sending is successfull echo "Your balance is $response->data->balance";, (*28)

   })->onError(function($response)
   {
       // Logic on Error 
   })->schedule("FORMART")
     ->sendSms($parcel);

```, (*29)

Support

Feel free to post your issues in the issues section., (*30)

The Versions

15/06 2017

dev-master

9999999-dev http://www.tooma.co.ke

Send and receive SMS anywhere in the world using our web services

  Sources   Download

MIT

The Requires

 

by Elijah Mwangi

laravel sms text message send receive tooma

15/06 2017

v0.0.5

0.0.5.0 http://www.tooma.co.ke

Send and receive SMS anywhere in the world using our web services

  Sources   Download

MIT

The Requires

 

by Elijah Mwangi

laravel sms text message send receive tooma

13/06 2017

v0.0.4

0.0.4.0 http://www.tooma.co.ke

Send and receive SMS anywhere in the world using our web services

  Sources   Download

MIT

The Requires

 

by Elijah Mwangi

laravel sms text message send receive tooma

13/06 2017

0.0.3

0.0.3.0 http://www.tooma.co.ke

Send and receive SMS anywhere in the world using our web services

  Sources   Download

MIT

The Requires

 

by Elijah Mwangi

laravel sms text message send receive tooma

13/06 2017

0.0.2

0.0.2.0 http://www.tooma.co.ke

Send and receive SMS anywhere in the world using our web services

  Sources   Download

MIT

The Requires

 

by Elijah Mwangi

laravel sms text message send receive tooma

13/06 2017

0.0.1

0.0.1.0 http://www.tooma.co.ke

Send and receive SMS anywhere in the world using our web services

  Sources   Download

MIT

The Requires

 

by Elijah Mwangi

laravel sms text message send receive tooma