PHPackages                             iamserjo/sendgrid-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. iamserjo/sendgrid-php

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

iamserjo/sendgrid-php
=====================

This library allows you to quickly and easily send emails through Twilio SendGrid using PHP.

v7.5.0(6y ago)011MITPHPPHP &gt;=5.6

Since Apr 3Pushed 6y agoCompare

[ Source](https://github.com/iamserjo/sendgrid-php)[ Packagist](https://packagist.org/packages/iamserjo/sendgrid-php)[ Docs](http://github.com/sendgrid/sendgrid-php)[ RSS](/packages/iamserjo-sendgrid-php/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (1)Versions (77)Used By (0)

[![SendGrid Logo](https://github.com/sendgrid/sendgrid-python/raw/master/twilio_sendgrid_logo.png)](https://github.com/sendgrid/sendgrid-python/raw/master/twilio_sendgrid_logo.png)

[![BuildStatus](https://camo.githubusercontent.com/651d24f16a408ed3e0a3203008095dd3ad4f04cd18e722216415b3b6eb21a50e/68747470733a2f2f7472617669732d63692e6f72672f73656e64677269642f73656e64677269642d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/sendgrid/sendgrid-php)[![Packagist](https://camo.githubusercontent.com/3cf12a3dd69c0e3331f3a72b9af525dfee9fcf2bca65b81959d27a2a98a87363/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73656e64677269642f73656e64677269642e737667)](https://packagist.org/packages/sendgrid/sendgrid)[![Downloads](https://camo.githubusercontent.com/4225459d2e2a10d3fe0a29af58b35a3edfb960650de821ee1cf0cac55f1172bd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73656e64677269642f73656e64677269642e7376673f6d61784167653d33363030)](https://packagist.org/packages/sendgrid/sendgrid)[![Email Notifications Badge](https://camo.githubusercontent.com/b25e6b50959f1da489ed24095e6710a97f9fb4d90b60cec9e334d3c1985b8b2b/68747470733a2f2f64782e73656e64677269642e636f6d2f62616467652f706870)](https://dx.sendgrid.com/newsletter/php)[![MIT licensed](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](./LICENSE.md)[![Twitter Follow](https://camo.githubusercontent.com/de94c561669f318291c017e2043b37498ea2f8820d5f35be0af56fe149c1a793/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f666f6c6c6f772f73656e64677269642e7376673f7374796c653d736f6369616c266c6162656c3d466f6c6c6f77)](https://twitter.com/sendgrid)[![GitHub contributors](https://camo.githubusercontent.com/33eb2a8f329decb32cdcc0823c2436bb2a332949d4bf6d6e56aecbd28ec8a3e6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f73656e64677269642f73656e64677269642d7068702e737667)](https://github.com/sendgrid/sendgrid-php/graphs/contributors)[![Open Source Helpers](https://camo.githubusercontent.com/a4668894babbc68628728fb0687dd9eb0c9bb66c9199615100cddcb0597ce6b8/68747470733a2f2f7777772e636f64657472696167652e636f6d2f73656e64677269642f73656e64677269642d7068702f6261646765732f75736572732e737667)](https://www.codetriage.com/sendgrid/sendgrid-php)

**NEW:**

- Subscribe to email [notifications](https://dx.sendgrid.com/newsletter/php) for releases and breaking changes.
- Send SMS messages with [Twilio](https://github.com/sendgrid/sendgrid-php/blob/master/USE_CASES.md#sms).

**This library allows you to quickly and easily use the Twilio SendGrid Web API v3 via PHP.**

Version 7.X.X of this library provides full support for all Twilio SendGrid [Web API v3](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html) endpoints, including the new [v3 /mail/send](https://sendgrid.com/blog/introducing-v3mailsend-sendgrids-new-mail-endpoint).

We want this library to be community driven and Twilio SendGrid led. Your help is needed to realize this goal. To help make sure we are building the right things in the right order, we ask that you create [issues](https://github.com/sendgrid/sendgrid-php/issues) and [pull requests](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md) or simply upvote or comment on existing issues or pull requests.

Please browse the rest of this README for further details.

We appreciate your continued support, thank you!

Table of Contents
=================

[](#table-of-contents)

- [Installation](#installation)
- [Quick Start](#quick-start)
- [Use Cases](#use-cases)
- [Usage](#usage)
- [Announcements](#announcements)
- [Roadmap](#roadmap)
- [How to Contribute](#contribute)
- [Troubleshooting](#troubleshooting)
- [About](#about)
- [License](#license)

Installation
============

[](#installation)

Prerequisites
-------------

[](#prerequisites)

- PHP version 5.6, 7.0, 7.1, 7.2, 7.3, or 7.4
- The Twilio SendGrid service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-php) to send up to 40,000 emails for the first 30 days, then send 100 emails/day free forever or check out [our pricing](https://sendgrid.com/pricing?source=sendgrid-php).
- For SMS messages, you will need a free [Twilio account](https://www.twilio.com/try-twilio?source=sendgrid-php).

Setup Environment Variables
---------------------------

[](#setup-environment-variables)

Update the development environment with your [SENDGRID\_API\_KEY](https://app.sendgrid.com/settings/api_keys), for example:

1. Copy the sample env file to a new file named `.env`

```
cp .env.sample .env
```

2. Edit the `.env` file to include your `SENDGRID_API_KEY`
3. Source the `.env` file

```
source ./.env
```

Install Package
---------------

[](#install-package)

Add Twilio SendGrid to your `composer.json` file. If you are not using [Composer](http://getcomposer.org), we highly recommend it. It's an excellent way to manage dependencies in your PHP application.

```
{
  "require": {
    "sendgrid/sendgrid": "~7"
  }
}
```

#### Alternative: Install package from zip

[](#alternative-install-package-from-zip)

If you are not using Composer, simply download and install the **[latest packaged release of the library as a zip](https://github.com/sendgrid/sendgrid-php/releases/download/7.5.0/sendgrid-php.zip)**.

[**⬇︎ Download Packaged Library ⬇︎**](https://github.com/sendgrid/sendgrid-php/releases/download/7.5.0/sendgrid-php.zip)

Previous versions of the library can be found in the [version index](https://sendgrid-open-source.s3.amazonaws.com/index.html) or downloaded directly from [GitHub](https://github.com/sendgrid/sendgrid-php/releases).

Dependencies
------------

[](#dependencies)

- The Twilio SendGrid Service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-php)
- The dependency free [php-http-client](https://github.com/sendgrid/php-http-client)

Quick Start
===========

[](#quick-start)

Hello Email
-----------

[](#hello-email)

The following is the minimum needed code to send an email. You may find more examples in our USE\_CASES file:

```
