This package makes it easy to send sms notifications using Ileti Merkezi with Laravel 7.0 , 8.0 , 9.0 , 10.0 and 11.0
You can install this package via composer:
composer require macellan/ileti-merkezi
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'),
'secret' => env('ILETIMERKEZI_SECRET'),
'origin' => env('ILETIMERKEZI_ORIGIN'),
'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
],
],
...
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);
}
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());
Please see CHANGELOG for more information what has changed recently.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Please see CONTRIBUTING for details.