1. Go to this page and download the library: Download renderbit/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/ */
use Sms;
Sms::send('+919999999999', 'Hello, your OTP is 123456');
use Renderbit\Sms\SmsClient;
class NotificationService
{
public function __construct(protected SmsClient $sms) {}
public function notify(string $phone, string $message): bool
{
return $this->sms->send($phone, $message);
}
}
Sms::send('+919999999999', 'Hello {{ name }}, your code is {{ code }}', [
'name' => 'John',
'code' => 'ABC123',
]);
// Sends: "Hello John, your code is ABC123"
if (! Sms::send($phone, $message)) {
// Log failure or retry
}
// Disable SMS in tests (sending is logged, not actually sent)
config(['sms.enabled' => false]);