Lob.com 通知通道,适用于 Laravel 5.3
1.2.0
2020-03-07 00:35 UTC
Requires
- php: >=7.2.5
- illuminate/notifications: ~5.5 || ~6.0 || ~7.0
- illuminate/queue: ~5.5 || ~6.0 || ~7.0
- illuminate/support: ~5.5 || ~6.0 || ~7.0
- lob/lob-php: ^3.0
Requires (Dev)
- mockery/mockery: ^1.0
- phpunit/phpunit: ~8.0
This package is auto-updated.
Last update: 2024-09-07 09:38:55 UTC
README
本包使得使用 Lob.com 发送通知变得简单,支持 Laravel 5.5, 6.x 和 7.x
内容
安装
您可以通过 composer 安装此包
composer require laravel-notification-channels/lob
您必须安装服务提供者
// config/app.php 'providers' => [ ... NotificationChannels\Lob\LobServiceProvider::class, ],
设置 lob
// config/services.php ... 'lob' => [ 'api_key' => env('LOB_API_KEY'), ], ...
用法
现在您可以在通知的 via()
方法中使用此通道
use NotificationChannels\Lob\LobChannel; use NotificationChannels\Lob\LobPostcard; use NotificationChannels\Lob\LobAddress; use Illuminate\Notifications\Notification; class AccountApproved extends Notification { public function via($notifiable) { return [LobChannel::class]; } public function toLobPostcard($notifiable) { return LobPostcard::create() ->toAddress( LobAddress::create('300 BOYLSTON AVE E') ->name('John Smith') ->city('SEATTLE') ->state('WA') ->zip('98002'); ) ->front('https://path.to/my/image/postcardfront.png') ->message('Wishing you a wonderful weekend!'); } }
可用的明信片方法
fromAddress()
发送者的地址。toAddress()
收件人的地址。country()
设置国家。默认为US
。city()
如果国家为US
则必须。state()
如果国家为US
则必须。zip()
如果国家为US
则必须。front()
作为明信片正面使用的 4.25"x6.25" 或 6.25"x11.25" 的图片。message()
明信片背面的信息。
变更日志
请参阅 CHANGELOG 了解最近更改的详细信息。
测试
$ composer test
安全
如果您发现任何安全问题,请通过电子邮件 themsaid@gmail.com 而不是使用问题跟踪器。
贡献
请参阅 CONTRIBUTING 了解详细信息。
致谢
许可
MIT 许可证 (MIT)。请参阅 许可文件 了解更多信息。