Download the PHP package farsi/laravel-smsir without Composer
On this page you can find all versions of the php package farsi/laravel-smsir. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-smsir
Laravel sms.ir
A modern Laravel client for the sms.ir v1 API — sending, delivery reports, the inbox, and a notification channel.
Supports Laravel 10, 11, 12 and 13 on PHP 8.2+.
Installation
Publish the config:
Then set your credentials:
Usage
Recipients are accepted in any common Iranian format and normalised for you —
09120000000, 9120000000, +989120000000 and 00989120000000 are equivalent.
Named templates
Rather than scattering template ids through your code, name them in config:
Reports and inbox
Dates come back as CarbonImmutable, and mobile numbers come back correctly —
see Two upstream quirks.
Notification channel
Plain text works too:
The recipient is taken from routeNotificationFor('smsir') when you define it,
and otherwise from a mobile, phone or phone_number attribute. A notifiable
with no number is skipped rather than treated as an error.
Events
SmsSending carries a mutable payload, so you can redirect every message to a
test number outside production:
Database logging (optional)
Off by default. To switch it on:
One row per recipient per attempt, successes and failures alike. The model is
swappable via smsir.logging.model. Logging can never break a send — if the
write fails, the failure is swallowed, because losing a log row is strictly
better than turning a delivered message into an application error.
Error handling
Prefer failing soft? Set SMSIR_THROW=false and calls return null (or a zero
credit) instead of throwing. Events still fire either way, so logging and
alerting behave identically under both settings.
ConnectionFailedException is deliberately distinct from a rejection: a timeout
means the message may well have been sent, so retrying it risks a duplicate.
Two upstream quirks, handled for you
Mobile numbers lose their leading zero. sms.ir types them as int64, so
09120000000 comes back as 9120000000. A naive client silently corrupts every
number it reads back. This package restores them.
Dates are Unix int32, not strings. You pass Carbon, you get
CarbonImmutable — the integer conversion happens at the boundary.
What this package deliberately does not do
The legacy URL-send endpoint (GET|POST /v1/send) is not implemented. It
authenticates with your account username and password as query parameters,
which puts credentials into access logs, proxies and referrer headers. bulk
does the same job under API-key auth, so Smsir::send() uses that instead.
The package also ships no routes, no views, and no assets.
Testing
Everything goes through Laravel's HTTP client, so Http::fake() works out of the box:
The package's own suite never touches the network.
Upstream drift
resources/openapi/smsir-v1.json is a vendored copy of the published OpenAPI
document, and a test asserts the package's endpoint map still matches it. If
sms.ir removes an endpoint or adds one, CI fails rather than production. Refresh
it with:
Credits
Forked from IPeCompany/SmsirLaravel
(© 2017 PHPlus, authored by moein.alizadeh). That package targeted the retired
ws.sms.ir token API and had not been released since 2018; this is a rewrite
against the current v1 API, retaining its MIT licence and original copyright.
License
MIT. See LICENSE.md.
All versions of laravel-smsir with dependencies
illuminate/contracts Version ^10.0|^11.0|^12.0|^13.0
guzzlehttp/guzzle Version ^7.2
spatie/laravel-package-tools Version ^1.93