alizne / smsapi
Laravel SMS package for Iranian panels (sms.ir, Kavenegar, Ghasedak, …) with sandbox integration tests
Requires
- php: ^8.1
- ext-curl: *
- ext-json: *
- guzzlehttp/guzzle: ^7.5
- illuminate/support: ^9.0|^10.0|^11.0|^12.0
Requires (Dev)
- orchestra/testbench: ^7.0|^8.0|^9.0|^10.0
- phpunit/phpunit: ^9.6|^10.0|^11.0
- vlucas/phpdotenv: ^5.5
Suggests
None
Provides
None
Conflicts
None
Replaces
- alizne/smsapi: v2.1.0
This package is auto-updated.
Last update: 2026-10-10 11:54:53 UTC
README
Laravel package for Iranian SMS panels (sms.ir, Kavenegar, Ghasedak, Farazsms, IPPanel, Magfa, Niksms, …).
composer require alizeinodin/smsapi php artisan vendor:publish --tag=smsapi-config
.env:
SMSAPI_DRIVER=smsir SMSAPI_API_KEY=your-api-key SMSAPI_LINE_NUMBER=30007
use Alizeinodin\SmsApi\Facades\Sms; Sms::send('09121234567', 'سلام'); Sms::driver('kavenegar')->send('09121234567', 'سلام'); Sms::sendTemplate('09121234567', 123456, ['Code' => '12345']);
Sandbox / live panel tests
Only sms.ir documents an official Sandbox API key. Other panels use your test account credentials against the real API.
- Copy
.env.sandbox.example→.env.sandboxand fill credentials. - Unit tests (default, no network):
composer test # or: vendor/bin/phpunit --exclude-group sandbox
- Live sandbox tests:
composer test:sandbox
# or: vendor/bin/phpunit --group sandbox
Missing credentials → tests are skipped, not failed.
sms.ir Sandbox
Create an API key with type Sandbox in the panel, then:
SMSAPI_API_KEY=your-sandbox-key SMSAPI_SANDBOX_MOBILE=0912xxxxxxx
The verify call uses template 123456 and parameter Code (no real SMS / no credit).
use Alizeinodin\SmsApi\Registry\DriverRegistry; $driver = DriverRegistry::make('smsir', [ 'api_key' => env('SMSAPI_API_KEY'), ]); $driver->sendSandboxVerify('09121234567', '12345');
Drivers
| Config key | Provider |
|---|---|
smsir |
sms.ir |
kavenegar |
Kavenegar |
ghasedak |
Ghasedak |
farazsms |
Farazsms |
ippanel |
IPPanel |
magfa |
Magfa |
niksms |
Niksms |
mediana |
Mediana |
limosms |
Limosms |
melipayamak / farapayamak / payamito / payamaknovin / bahmanpayam / amoot |
Payamak-panel family |
payamresan / behinpayam / rastinsms |
sms-webservice V3 |
avanak |
Avanak (voice) |
See .env.sandbox.example for every credential key.
Messengers
Configured under the same drivers map (telegram, bale, eitaa, gap, whatsapp, …).
| Driver | Core send | Notes |
|---|---|---|
telegram / bale / eitaa / gap |
text | Minimal bot send; Gap requires type=text |
whatsapp |
text + templates | sendTemplate($mobile, 'template_name', $vars, ['language' => 'fa']) |
messenger |
text | Override messaging_type / tag via options |
slack |
text | Optional blocks, thread_ts |
discord |
text | Optional embeds |
viber / line |
text | LINE accepts empty 200 body; optional custom messages |
rubika |
text | May time out from non-IR networks |
igap |
experimental | Default host bot.igap.net is NXDOMAIN; official iGap is protobuf/WebSocket |
Foreign messengers are send-focused adapters, not full Bot SDKs (no webhooks, media upload pipelines, or conversation state).
Verification without panel accounts
Unit tests compare request shapes with official SDKs (Ghasedak, IPPanel, sms.ir, Kavenegar, LimoSMS, Mediana, Telegram, Gap, WhatsApp template, …) and check that public API hosts are reachable.
vendor/bin/phpunit --exclude-group sandbox
For Ghasedak without registration, calling accountInfo() with any key returns a structured API error (e.g. invalid apikey) — that confirms the HTTP contract is correct.
Live send confidence still needs real API keys for the panels/messengers you ship; contract + reachability alone do not prove delivery.