taiwan-sms / every8d
every8d sms api client
Installs: 10 650
Dependents: 0
Suggesters: 0
Security: 0
Stars: 17
Watchers: 1
Forks: 2
Open Issues: 0
Requires
- php: >=5.5.9
- nesbot/carbon: ^1.22|^v2.0
- php-http/client-implementation: ^1.0
- php-http/discovery: ^1.2
- php-http/httplug: ^1.1|^2.0
- php-http/message: ^1.5
Requires (Dev)
- illuminate/config: ^5.1|^6.0|^7.0|^8.0|^9.0
- illuminate/container: ^5.1|^6.0|^7.0|^8.0|^9.0
- illuminate/notifications: ^5.1|^6.0|^7.0|^8.0|^9.0
- illuminate/queue: ^5.1|^6.0|^7.0|^8.0|^9.0
- illuminate/support: ^5.1|^6.0|^7.0|^8.0|^9.0
- mockery/mockery: ^1.0
- phpunit/phpunit: ~4.8|~5.4|~6.1|^8.5|^9.5
- roave/security-advisories: dev-latest
Suggests
- illuminate/notifications: If you need Laravel Notification
This package is auto-updated.
Last update: 2024-10-06 14:16:06 UTC
README
This package makes it easy to send notifications using [every8d] with Laravel 5.3+.
Contents
Installation
You can install the package via composer:
composer require taiwan-sms/every8d illuminate/notifications php-http/guzzle6-adapter
Then you must install the service provider:
// config/app.php 'providers' => [ ... TaiwanSms\Every8d\Every8dServiceProvider::class, ],
Setting up the Every8d service
Add your Every8d login, secret key (hashed password) and default sender name (or phone number) to
your config/services.php
:
// config/services.php ... 'every8d' => [ 'user_id' => env('SERVICES_EVERY8D_USER_ID'), 'password' => env('SERVICES_EVERY8D_PASSWORD'), 'sms_host' => env('SERVICES_EVERY8D_SMS_HOST') ], ...
Usage
You can use the channel in your via()
method inside the notification:
use TaiwanSms\Every8d\Every8dMessage; use TaiwanSms\Every8d\Every8dChannel; use Illuminate\Notifications\Notification; class AccountApproved extends Notification { public function via($notifiable) { return [Every8dChannel::class]; } public function toEvery8d($notifiable) { return Every8dMessage::create("Task #{$notifiable->id} is complete!"); } }
In your notifiable model, make sure to include a routeNotificationForEvery8d() method, which return the phone number.
public function routeNotificationForEvery8d() { return $this->phone; }
Available methods
subject()
: Sets a subject of the notification subject.
content()
: Sets a content of the notification message.
sendTime()
: Set send time of the notification 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 recca0120@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.
API Only
composer require taiwan-sms/every8d php-http/guzzle6-adapter
How to use
require __DIR__.'/vendor/autoload.php'; use TaiwanSms\Every8d\Client; $userId = 'xxx'; $password = 'xxx'; $client = new Client(userId, $password); $client->credit(); // 取得額度 var_dump($client->send([ 'to' => '09xxxxxxxx', 'text' => 'test message', ])); /* return [ 'credit' => 100.0, 'sended' => 1, 'cost' => 1.0, 'unsend' => 0, 'batchId' => 'd0ad6380-4842-46a5-a1eb-9888e78fefd8', ]; */