laravel maintained by farazsms
farazsms/laravel
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, and 11 · PHP 8.0+.
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.