natsumework / laravel-notification-mitake
:package_description
Requires
- php: >=7.1
- guzzlehttp/guzzle: ^6.2 || ^7.0
- illuminate/notifications: ~5.5 || ~6.0 || ~7.0 || ~8.0 || ^9.0 || ^10.0 || ^11.0
- illuminate/support: ~5.5 || ~6.0 || ~7.0 || ~8.0 || ^9.0 || ^10.0 || ^11.0
Requires (Dev)
- phpunit/phpunit: ^7.0 || ^8.0 || ^9.3
This package is auto-updated.
Last update: 2025-04-22 07:54:41 UTC
README
This package(non-official) makes it easy to send notifications using Mitake with Laravel 5.5+ and 6.x and 7.x
Here's the latest documentation on Laravel's Notifications System:
https://laravel.com/docs/master/notifications
Contents
Installation
composer require natsumework/laravel-notification-mitake
Setting up the Mitake service
Add your Mitake Account, Password, and Api endpoint url (optional) to your config/services.php
:
// config/services.php
...
'mitake' => [
'username' => env('MITAKE_USERNAME'), // reqired
'password' => env('MITAKE_PASSWORD'), // reqired
'url' => env('MITAKE_URL'), // optional (has default value): e.g. 'https://{三竹網域名稱}/api/mtk/SmSend
],
...
Usage
Now you can use the channel in your via() method inside the notification:
use NotificationChannels\Mitake\MitakeChannel;
use NotificationChannels\Mitake\MitakeMessage;
use Illuminate\Notifications\Notification;
class SmsNotification extends Notification
{
public function via($notifiable)
{
return [MitakeChannel::class];
}
public function toMitake($notifiable)
{
return (new MitakeMessage())
->content("Your message...");
}
}
You can also set 'dstaddr' or 'vldtime' or 'clientid' option (about the options please refer to the mitake api docs):
class SmsNotification extends Notification
{
...
public function toMitake($notifiable)
{
return (new MitakeMessage())
->content("Your message...")
->to("0900000000") // dstaddr: phone number
->vldTime("900") // Validity period: 900 second
->clientId("ce910656-7bd1-11ea-bc55-0242ac130003"); //Check duplicate sending
}
...
Phone number
In order to let your Notification know which phone are you sending to, you need to set the phone number in MitakeMessage
class SmsNotification extends Notification
{
...
public function toMitake($notifiable)
{
return (new MitakeMessage())
->to("0900000000") // dstaddr: phone number
...
}
...
You can also add the routeNotificationForMitake method to your Notifiable model.
public function routeNotificationForMitake()
{
return '0900000000';
}
or you can use the on-demand-notifications
Notification::route('mitake', '0900000000')
->notify(new SmsNotification($message));
Changelog
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Security
If you discover any security related issues, please email natsumework0902@gmail.com instead of using the issue tracker.
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.