farazsms/laravel
Composer 安装命令:
composer require farazsms/laravel
包简介
Laravel integration for FarazSMS · IranPayamak (فراز اس ام اس · ایران پیامک) — https://farazsms.com. Facade, config, and an SMS notification channel.
README 文档
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, 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.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-18