This package makes it easy to send notifications using [mitake] with Laravel 5.3+.
You can install the package via composer:
composer require recca0120/mitake illuminate/notifications php-http/guzzle6-adapterThen you must install the service provider:
// config/app.php'providers' => [
...
Recca0120\Mitake\MitakeServiceProvider::class,
],Add your Mitake login, secret key (hashed password) and default sender name (or phone number) to your config/services.php:
// config/services.php...'mitake' => [
'username' => env('SERVICES_MITAKE_USERNAME'),
'password' => env('SERVICES_MITAKE_PASSWORD'),
],
...You can use the channel in your via() method inside the notification:
useRecca0120\Mitake\MitakeMessage;
useRecca0120\Mitake\MitakeChannel;
useIlluminate\Notifications\Notification;
class AccountApproved extends Notification
{
publicfunctionvia($notifiable)
{
return [MitakeChannel::class];
}
publicfunctiontoMitake($notifiable)
{
return MitakeMessage::create("Task #{$notifiable->id} is complete!");
}
}In your notifiable model, make sure to include a routeNotificationForTwSMS() method, which return the phone number.
publicfunctionrouteNotificationForTwSMS()
{
return$this->phone;
}subject(): Sets a subject of the notification subject.
content(): Sets a content of the notification message.
sendTime(): Set send time of the notification message.
Please see CHANGELOG for more information what has changed recently.
$ composer testIf you discover any security related issues, please email recca0120@gmail.com instead of using the issue tracker.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.
composer require recca0120/mitake php-http/guzzle6-adapterrequire__DIR__.'/vendor/autoload.php';
useRecca0120\Mitake\Client;
$userId = 'xxx';
$password = 'xxx';
$client = newClient(userId, $password);
var_dump($client->credit()); // 取得額度var_dump($client->send([
'to' => '09xxxxxxxx',
'text' => 'test message',
]));
/*return [ 'msgid' => '0892448417', 'statuscode' => '1', 'AccountPoint' => '97',];*/
