Skip to content

templates

alizeinodin edited this page Sep 11, 2026 · 2 revisions

Templates

Register logical names once; map to each provider’s template / pattern ID.

// config/smsapi.php
'templates' => [
    'otp-login' => [
        'smsir' => 100000,
        'kavenegar' => 'verify',
        'array' => 'otp-array',
        'mail' => [
            'subject' => 'Your login code',
        ],
    ],
],

Delivery API

// You supply the code
Sms::template('otp-login')->to($user)->send(['CODE' => '12345']);

// Alias (still delivery-only — not the vault)
Sms::otp('otp-login')->to($user)->send(['CODE' => '12345']);

// Channels
Sms::otp('otp-login')->to($user)->mail()->send(['CODE' => '12345']);
Sms::otp('otp-login')->to($user)->both()->send(['CODE' => '12345']);
SMSAPI_OTP_CHANNEL=sms   # sms | mail | both

Warning: Sms::otp() does not generate or verify codes. See OTP vault.

Clone this wiki locally