macellan/ileti-merkezi
最新稳定版本:v1.4.0
Composer 安装命令:
composer require macellan/ileti-merkezi
包简介
Ileti Merkezi SMS notification channel for Laravel
README 文档
README
This package makes it easy to send sms notifications using Ileti Merkezi with Laravel 7.0+, 8.0+, 9.0+, 10.0+ 11.0+ and 12.0+
Contents
Installation
You can install this package via composer:
composer require macellan/ileti-merkezi
Setting up the Ileti Merkezi service
Add your Ileti Merkezi sms gate login, password and default sender name to your config/services.php:
// config/services.php ... 'sms' => [ 'iletimerkezi' => [ 'key' => env('ILETIMERKEZI_KEY'), 'hash' => env('ILETIMERKEZI_HASH'), 'origin' => env('ILETIMERKEZI_ORIGIN'), // sender title 'enable' => env('ILETIMERKEZI_ENABLE', true), 'debug' => env('ILETIMERKEZI_DEBUG', false), // will log sending attempts and results 'sandboxMode' => env('ILETIMERKEZI_SANDBOX_MODE', false) // will not invoke API call ], ], ...
Usage
You can use the channel in your via() method inside the notification:
use Illuminate\Notifications\Notification; use Macellan\IletiMerkezi\IletiMerkeziMessage; class AccountApproved extends Notification { public function via($notifiable) { return ['iletimerkezi']; } public function toIletiMerkezi($notifiable) { return IletiMerkeziMessage::create() ->setBody('Your account was approved!') ->setSendTime(now()); } }
In your notifiable model, make sure to include a routeNotificationForSms() method, which returns a phone number or an array of phone numbers.
public function routeNotificationForSms() { return str_replace(['+', ' '], '', $this->phone); }
On-Demand Notifications
Sometimes you may need to send a notification to someone who is not stored as a "user" of your application. Using the Notification::route method, you may specify ad-hoc notification routing information before sending the notification:
Notification::route('sms', '905322234433') ->notify(new AccountApproved());
Changelog
Please see CHANGELOG for more information what has changed recently.
Security
If you discover any security related issues, please email fatih@aytekin.me instead of using the issue tracker.
Contributing
Please see CONTRIBUTING for details.
Credits
统计信息
- 总下载量: 8.44k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-10-15