PHP code example of therealsmat / laravel-ebulksms

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

    

therealsmat / laravel-ebulksms example snippets


     
    
    return [
    
        /**
         * Your login username on eBulkSMS (same as your email address)
         */
        'username'          => getenv('EBULK_USERNAME'),
    
        /**
         * Your Ebulk SMS Api Key
         */
        'apiKey'            => getenv('EBULK_API_KEY'),
    
        /**
         * Your chosen sender name
         */
        'sender'            => getenv('EBULK_SENDER_NAME'),
    
        /**
         * Country code to be appended to each phone number
         */
        'country_code'      => '234'
    ];

    Route::get('/sms', 'HomeController@index');

    
    
    namespace App\Http\Controllers;
    
    use Illuminate\Http\Request;
    use therealsmat\Ebulksms\EbulkSMS;
    
    class HomeController extends Controller
    {
        public function index(EbulkSMS $sms)
        {
            $message = 'Hello world!';
            $recipients = '0701********';
            return $sms->composeMessage($message)
                        ->addRecipients($recipients)
                        ->send();
        }
    }

    
        
        namespace App\Http\Controllers;
        
        use Illuminate\Http\Request;
        use therealsmat\Ebulksms\EbulkSMS;
        
        class HomeController extends Controller
        {
            public function index(EbulkSMS $sms)
            {
                $message = 'Hello world!';
                $recipients = '0701********';
                return $sms->composeMessage($message)
                            ->addRecipients($recipients)
                            ->flash();
            }
        }

    
            
            namespace App\Http\Controllers;
            
            use Illuminate\Http\Request;
            use therealsmat\Ebulksms\EbulkSMS;
            
            class HomeController extends Controller
            {
                public function index(EbulkSMS $sms)
                {
                    return $sms->getBalance();
                }
            }