farazsms / laravel
Laravel integration for FarazSMS · IranPayamak (فراز اس ام اس · ایران پیامک) — https://farazsms.com. Facade, config, and an SMS notification channel.
Requires
- php: >=8.0
- farazsms/php: ^1.0
- illuminate/support: ^9.0|^10.0|^11.0|^12.0|^13.0
Suggests
- illuminate/notifications: Required only for the FarazSMS notification channel (^9.0|^10.0|^11.0|^12.0|^13.0).
This package is not auto-updated.
Last update: 2026-08-09 14:23:08 UTC
README
FarazSMS · IranPayamak (فراز اس ام اس · ایران پیامک)
Laravel integration for the FarazSMS · IranPayamak SMS platform. Ships a Facade, a publishable config file, and a notification channel for sending pattern (template) and simple text messages.
Supports Laravel 9, 10, 11, 12, and 13 · PHP 8.0+.
Composer resolves against the PHP you run: Laravel 9–11 needs PHP 8.0+/8.1+, Laravel 12 needs 8.2+, Laravel 13 needs 8.3+.
Upgrading to 1.1 from 1.0
FARAZSMS_BASE_URL never actually took effect in 1.0 — the provider looked for a
client method that does not exist, so every request went to the default endpoint.
It works now. If you have a stale FARAZSMS_BASE_URL in your .env, traffic will
start going there. Check that value before upgrading.
Installation
composer require farazsms/laravel
The service provider and the Farazsms facade alias are registered automatically via Laravel package auto-discovery.
Configuration
Publish the config file:
php artisan vendor:publish --tag=farazsms-config
Then set your API key in .env:
FARAZSMS_API_KEY=your-api-key # Optional overrides: FARAZSMS_BASE_URL=https://api.iranpayamak.com FARAZSMS_LINE=90008361
Facade usage
use FarazSMS\Laravel\Facades\Farazsms; // Check your balance $balance = Farazsms::balance(); // Send a pattern (template) message Farazsms::sendPattern('verify-code', '09120000000', ['code' => '1234']); // Send a simple text message Farazsms::sendSimple('سلام دنیا', ['09120000000']);
Notification channel
Route notifications through the farazsms channel. Add a recipient resolver to your notifiable
(routeNotificationForFarazsms(), or simply a phone / mobile attribute), then build the message
with FarazsmsMessage.
use Illuminate\Notifications\Notification; use FarazSMS\Laravel\Notifications\FarazsmsMessage; class VerifyCodeNotification extends Notification { public function __construct(public string $code) { } public function via($notifiable): array { return ['farazsms']; } public function toFarazsms($notifiable): FarazsmsMessage { return FarazsmsMessage::pattern('verify-code', ['code' => $this->code]); // Or a plain text message: // return FarazsmsMessage::simple("Your code is {$this->code}"); } }
On the notifiable model, expose the destination number:
public function routeNotificationForFarazsms($notification): string { return $this->mobile; // or $this->phone }
Dispatch as usual:
$user->notify(new VerifyCodeNotification('1234'));
License
Released under the MIT License. Copyright (c) 2026 FarazSMS.