feat(sms): simplify SMS settings to use only KAVENEGAR_API_KEY from env, remove other SMS-related fields from config

This commit is contained in:
hamed
2026-07-01 11:53:16 +03:30
parent 9d8d1014f1
commit b366baa64c
11 changed files with 352 additions and 92 deletions
+3 -6
View File
@@ -2,7 +2,6 @@
namespace App\Sms\Provider;
use App\Config\Repository\SiteConfigRepository;
use Psr\Log\LoggerInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
@@ -12,16 +11,14 @@ class KavehNegarProvider implements SmsProviderInterface
public function __construct(
private readonly HttpClientInterface $httpClient,
private readonly SiteConfigRepository $configRepo,
private readonly LoggerInterface $logger,
// Nullable: env `%env(default::KAVENEGAR_API_KEY)%` resolves to null when unset
// (the real key normally comes from DB site config below, not env).
// API key comes only from env `%env(default::KAVENEGAR_API_KEY)%`; null when unset.
private readonly ?string $apiKey = null,
private readonly ?string $sender = null,
) {}
private function key(): string { return $this->configRepo->get('kavenegar_api_key') ?: ($this->apiKey ?? ''); }
private function sender(): string { return $this->configRepo->get('kavenegar_sender') ?: ($this->sender ?? ''); }
private function key(): string { return $this->apiKey ?? ''; }
private function sender(): string { return $this->sender ?? ''; }
public function getName(): string { return 'kavenegar'; }