mlk9 / ippanel-laravel
Send SMS notification based on channel Laravel (Ippanel SMS service)
Installs: 60
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 1
pkg:composer/mlk9/ippanel-laravel
Requires
- php: >=7.4
- illuminate/support: >=6
Requires (Dev)
- guzzlehttp/guzzle: >=7
- orchestra/testbench: >=4
- phpunit/phpunit: >=9
README
پکیج لاراولی ارسال اس ام اس سازگار با نوتیفیکیشن برای آپی پنل
نیازمندی ها
- لاراول 6+
- PHP 7.4+
ویژگی ها
- سریع و ساده
- اتصال امن
- سازگار با نوتیفیکیشن
نصب
نصب پکیج به وسیله کامپوزر:
composer require mlk9/ippanel-laravel
عمومی کردن تنظیمات
php artisan vendor:publish --tag=ippanel-laravel
جزئیات دقیق کانفیگ
// config/services.php 'ippanel' => [ 'server' => 'https://ippanel.com/services.jspd', 'username' => 'YOUR_IPPANEL_USERNAME', 'password' => 'YOUR_IPPANEL_PASSWORD', 'originator' => 'YOUR_IPPANEL_ORIGINATOR', ],
استفاده
با استفاده از فساد
<?php
use Mlk9\Sms\Facades\Sms;
//get credit
Sms::getCredit(); // res : 933222.33
//send message
Sms::sendMessage(string $text,array|string $recipients); // bool
//send pattern message
Sms::sendPatternMessage(string $code_pattern,string $recipient,array $entries = []);// bool
با استفاده از نوتیفیکیشن لاراول
افزودن 'sms' به نوتیفیکیشن مد نظر
و ایجاد فانکشن toSms به این شکل :
class ExampleNotification extends Notification
{
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['sms'];
}
//for pattern sms
public function toSms($notifiable)
{
return [
'type' => 'patternMessage',
'code' => 'YOUR CODE PATTERN',//string
'values' => ['name'=>$notifiable->name],//array
'recipient'=> $notifiable->phone,//string
];
}
//for simple sms
// public function toSms($notifiable)
// {
// return [
// 'type' => 'message',
// 'message' => 'YOUR MESSAGE',
// 'recipient'=> [$notifiable->phone], // shoud be arrray
// ];
// }