fav-in-blockchain / notifier
v2.11.1
2022-08-28 13:27 UTC
Requires
- php: 7.1.*|7.2.*|7.3.*|7.4.*|8.*
- ghasedak/php: 1.*
- laravel/framework: 7.*|8.*
README
这是一个用于短信服务集成的 Laravel 扩展包。
可用驱动程序列表
如何安装和配置 fav-in-blockchain/notifier 扩展包?
安装
composer require favinblockchain/notifier
发布配置文件
php artisan vendor:publish --tag=notifier
迁移表,向数据库添加 notifier 表
php artisan migrate
如何使用扩展包中的驱动程序
-
在 /config/notifier.php 中设置配置
-
使用此示例代码发送短信
Notifier::driver('{driver_name}(like ghasedak)') ->userId(user_id_integer) ->templateId({template_id_integer(must be defined in a seeder)}) ->params(['param1' => 'string', ... ,'param10' => 'string']) ->options(['method' => '{driver_method_name}(like otp)','hasPassword' => 'if_this_message_has_password(yes or no)']) ->send();
-
Ghasedak OTP 方法示例
Notifier::driver('ghasedak') ->userId(2) ->templateId(1) ->params(['param1' => 'passwdsd12ds']) ->options(['method' => 'otp','ghasedak_template_name' => 'registration', 'hasPassword' => 'yes']) ->send();
参数
模板 Seeder
- 基本和标准结构
public function run() { DB::table('notifier_sms_templates')->insertOrIgnore([ [ 'id' => 1, 'template_text' => 'جهت اطلاعات بیشتر به این وبسایت مراجعه کنید : [param1]', 'created_at' => now(), 'updated_at' => now(), ] ]); }
- id : 用于 templateId 选项
- template_text : 在您的消息文本中按数字(最多 10)添加参数(例如 [param1] 或 [param2])
要求
- PHP v7.0 或以上
- Laravel v7.0 或以上
- ghasedak/php 扩展包 Packagist 链接