Files
site/app/Support/Sms/SmsRu.php
2025-04-21 16:03:20 +02:00

40 lines
801 B
PHP

<?php
namespace App\Support\Sms;
use GuzzleHttp\Client;
class SmsRu implements SmsApi
{
private $appId;
private $url;
private $client;
public function __construct($appId, $url = 'https://sms.ru/sms/send')
{
if (empty($appId)) {
throw new \InvalidArgumentException('Sms appId must be set.');
}
$this->appId = $appId;
$this->url = $url;
$this->client = new Client();
}
public function sendText($number, $text): void
{
$this->client->post($this->url, [
'form_params' => [
'api_id' => $this->appId,
'to' => '+' . trim($number, '+'),
'text' => $text
],
]);
}
public function sendCall($number, $ip): void
{
}
}