1. Go to this page and download the library: Download zanysoft/laravel-intellisms 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/ */
namespace App\Notifications;
use Illuminate\Notifications\Notification;
use ZanySoft\LaravelIntelliSms\Messages\IntelliSmsMessage;
class SendSmsNotification extends Notification
{
public function via($notifiable)
{
return ['intellisms'];
}
public function toIntelliSms($notifiable)
{
return IntelliSmsMessage::create('Hello, this is your SMS message!')
->from('MySenderID')
->to($notifiable->phone_number);
}
}
use App\Notifications\SendSmsNotification;
$user->notify(new SendSmsNotification());
public function routeNotificationForIntelliSms($notification)
{
return $this->phone;
}
use ZanySoft\LaravelIntelliSms\Facades\IntelliSms;
// Send SMS
$response = IntelliSms::make('Hello, World!')
->to('27123456789') // Single number or array of numbers
->from('MyApp') // from is optional, uses config if not provided
->send();
// Check balance
$balance = IntelliSms::make()->balance();
use ZanySoft\LaravelIntelliSms\Exceptions\IntelliSmsException;
try {
IntelliSms::make('Hello, World!')
->to('27123456789') // Single number or array of numbers
->send();
} catch (IntelliSmsException $e) {
$message = $e->getMessage(); // Error message
$response = $e->response(); // Full provider response array
Log::error('SMS sending failed', [
'error' => $message,
'response' => $response,
]);
}