stephanecoinon / sendgrid-activity
SendGrid 电子邮件活动 API 的 PHP 客户端
dev-master
2019-08-05 21:50 UTC
Requires
- php: ^7.1
- guzzlehttp/guzzle: ^6.0
- nesbot/carbon: ^1.0 || ^2.0
- php-http/client-common: ^1.9 || ^2.0
- php-http/discovery: ^1.0
- php-http/guzzle6-adapter: ^2.0
- php-http/httplug: ^2.0
Requires (Dev)
- fzaninotto/faker: ^1.8
- orchestra/testbench: ^3.8
- php-http/mock-client: ^1.3
- phpunit/phpunit: ^7.0
- symfony/var-dumper: ^4.3
- vlucas/phpdotenv: ^3.4
This package is auto-updated.
Last update: 2024-09-06 09:32:06 UTC
README
基于 SendGrid API v3.
安装
您可以通过 composer 安装此包
composer require stephanecoinon/sendgrid-activity
此包是中立的,但也可以与 Laravel 集成(在 5.8 上进行了测试,但应支持 >=5.5)。
只需在 .env
中添加您的 SendGrid API 密钥
SENDGRID_API_KEY=your_API_key_here
然后更新 config/services.php
并完成设置
return [ // ... 'sendgrid' => [ 'key' => env('SENDGRID_API_KEY'), ], ];
使用方法
use StephaneCoinon\SendGridActivity\Requests\MessagesRequest; use StephaneCoinon\SendGridActivity\SendGrid; // First, get SendGrid API client instance // In vanilla PHP $api = new SendGrid('your API key here'); // Or in Laravel $api = app(SendGrid::class); // Fetch the message activity $messages = $api->request( (new MessagesRequest) ->limit(50) ->query('status="delivered"') ); // Note: $messages will be a \Illuminate\Support\Collection when in a Laravel app // Find a message by id $message = $api->request(MessagesRequest::find('message-id'));
测试
composer test
贡献
有关详细信息,请参阅 CONTRIBUTING。
安全
如果您发现任何安全相关的问题,请通过电子邮件发送到 me@stephanecoinon.co.uk 而不是使用问题跟踪器。
致谢
许可协议
MIT 许可协议 (MIT)。有关更多信息,请参阅 许可文件。
PHP 包模板
此包使用 PHP 包模板 生成。