dealhub/app/Services/TwilioService.php
kusowl 0b631f6049 feature(password reset): send otp via SMS
- use twilio to send otp via test sms
2026-01-29 18:50:53 +05:30

25 lines
528 B
PHP

<?php
namespace App\Services;
use Twilio\Exceptions\TwilioException;
use Twilio\Rest\Client;
class TwilioService
{
private Client $client;
public function __construct()
{
$this->client = new Client(config('services.twilio.sid'), config('services.twilio.token'));
}
/**
* @throws TwilioException
*/
public function sendSms(string $to, string $message): void
{
$this->client->messages->create($to, ['from' => config('services.twilio.from'), 'body' => $message]);
}
}