fastglass/sendgrid

This library allows you to send emails through SendGrid using PHP and Guzzle 6.x.

2.0.6 2023-01-10 23:58 UTC

This package is auto-updated.

Last update: 2024-11-11 04:06:43 UTC


README

This is a version of SendGrid-PHP which uses Guzzle 6.x

Quality Gate Status

This library allows you to quickly and easily send emails through SendGrid using PHP with the help of Guzzle 6.x. Guzzle is a very popular HTTP client for PHP used in many other PHP packages.

SendGrid has chosen to write their own PHP HTTP client. This module uses Guzzle instead. From the point that SendGrid choose to provide their own HTTP client library, this module was permanently forked away from the official code and is maintained independently of the official libraries. This module uses Guzzle for the transport layer and so the code is different. Contributions to help maintain this library is welcome!

Mainly, this API is maintained in support of the Drupal Sendgrid Integration Module that I also maintain. Drupal 8 ships with Guzzle 6.x in the core of the software and Guzzle 6.x supports the standardization of PSR messages. The official Sendgrid PHP API supports only the deprecated Guzzle 3.x as they are maintaining support for PHP 5.3.

To install this library it is best to use composer. I have published a package through Packagist for this library. Use the following in your composer.json:

"require": {
    "fastglass/sendgrid": ">=2.0.0"
  }

Code Examples

Refer to the examples' folder to examine how to use this library. The examples make use of environment variables for the API key. Export your API stored in an environment variable named SENDGRID_API_KEY.

Running Tests

The existing tests in the Tests directory can be run using PHPUnit with the following command:

composer update
composer install
./vendor/bin/phpunit ./Tests

or if you already have PHPUnit installed globally.

cd Tests
phpunit