1. Go to this page and download the library: Download codepagol/sms-bridge 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/ */
codepagol / sms-bridge example snippets
use Codepagol\SmsBridge\Facades\SmsBridge;
// Send a simple message using the fluent builder
$response = SmsBridge::to('01712345678')
->message('Hello from SmsBridge!')
->send();
// Send bulk SMS by passing an array of numbers
$responseBulk = SmsBridge::to(['01712345678', '01987654321'])
->message('Hello everyone!')
->send();
// (Legacy Syntax is still supported)
// $response = SmsBridge::send('01712345678', 'Hello from SmsBridge!');
// Check the raw array response from the API
if (isset($response['error'])) {
\Log::error("SMS Failed: ", $response);
}
// Dispatch to queue
SmsBridge::to('01712345678')
->message('This message is queued!')
->queue();
use Codepagol\SmsBridge\Facades\SmsBridge;
// Get the current balance of the active gateway (returns string or null)
$balance = SmsBridge::balance();
// Get the profile info array of the active gateway (returns array or null)
$profile = SmsBridge::profile();
use Codepagol\SmsBridge\SmsBridgeManager;
class NotificationController extends Controller
{
public function sendWelcomeSms(SmsBridgeManager $smsBridge)
{
$smsBridge->driver()
->to('01712345678')
->message('Welcome to our platform!')
->send();
}
}