Based on SendGrid API v3.
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'),
],
];
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
Please see CONTRIBUTING for details.
If you discover any security related issues, please email me@stephanecoinon.co.uk instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
This package was generated using the PHP Package Boilerplate.