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.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-smsir

Laravel sms.ir

tests phpstan packagist

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

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/contracts Version ^10.0|^11.0|^12.0|^13.0
guzzlehttp/guzzle Version ^7.2
spatie/laravel-package-tools Version ^1.93
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package farsi/laravel-smsir contains the following files

Loading the files please wait ...