PHP code example of keenops / laravel-sms

1. Go to this page and download the library: Download keenops/laravel-sms 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/ */

    

keenops / laravel-sms example snippets


namespace App\Http\Controllers;

use Keenops\Sms\Facades\Sms;

class SMSController extends Controller
{
    public function index()
    {
        $message = "Hello Word"; //String
        
        $recipients = ['255701000001', '255701000002', '25570100003']; //array
 
        return Sms::send($message, $recipients);
        //returns a json value with sent status

    }
}

namespace App\Http\Controllers;

use Keenops\Sms\Facades\Sms;

class SMSController extends Controller
{
    public function index()
    {
 
        return Sms::viewBalance();
        //returns Integer value of the remaining balance E.g 210
    }
}

namespace App\Http\Controllers;

use Keenops\Sms\Facades\Sms;

class SMSController extends Controller
{
    public function index()
    {
 
        return Sms::senderNames();
        //returns json list of registered sender name E.g 210
    }
}

namespace App\Http\Controllers;

use Keenops\Sms\Facades\Sms;

class SMSController extends Controller
{
    public function index()
    {
 
        return Sms::requestNewSenderName('API TEST','This is test api for new sender name using laravel beem package');
        //return json value of the new requested sender name

    }
}
bash
php artisan vendor:publish --tag=laravel-beem-sms