stephanecoinon / sendgrid-activity
PHP Client for SendGrid e-Mail Activity API
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-10-06 09:35:45 UTC
README
Based on SendGrid API v3.
Installation
You can install the package via composer:
composer require stephanecoinon/sendgrid-activity
This package is agnostic but also can integrate with Laravel (tested on 5.8 but should work >=5.5).
Just add your SendGrid API key in .env
:
SENDGRID_API_KEY=your_API_key_here
Then update config/services.php
and you're good to go:
return [ // ... 'sendgrid' => [ 'key' => env('SENDGRID_API_KEY'), ], ];
Usage
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'));
Testing
composer test
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email me@stephanecoinon.co.uk instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
PHP Package Boilerplate
This package was generated using the PHP Package Boilerplate.