PHPackages                             sendgrid/sendgrid - 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. sendgrid/sendgrid

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

sendgrid/sendgrid
=================

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

8.1.11(1y ago)1.5k47.5M—1.3%617[29 issues](https://github.com/sendgrid/sendgrid-php/issues)[7 PRs](https://github.com/sendgrid/sendgrid-php/pulls)20MITPHPPHP &gt;=7.3CI failing

Since Apr 3Pushed 1y ago243 watchersCompare

[ Source](https://github.com/sendgrid/sendgrid-php)[ Packagist](https://packagist.org/packages/sendgrid/sendgrid)[ Docs](http://github.com/sendgrid/sendgrid-php)[ RSS](/packages/sendgrid-sendgrid/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (116)Used By (20)

[![SendGrid Logo](twilio_sendgrid_logo.png)](twilio_sendgrid_logo.png)

[![BuildStatus](https://github.com/sendgrid/sendgrid-php/actions/workflows/test-and-deploy.yml/badge.svg)](https://github.com/sendgrid/sendgrid-php/actions/workflows/test-and-deploy.yml)[![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)[![MIT licensed](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)[![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:**

- Send SMS messages with [Twilio](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).

**If you need support using SendGrid, please check the [Twilio SendGrid Support Help Center](https://support.sendgrid.com).**

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)
- [How to Contribute](#contribute)
- [Troubleshooting](#troubleshooting)
- [About](#about)
- [Support](#support)
- [License](#license)

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

[](#installation)

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

[](#prerequisites)

- PHP version 7.3+
- 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/8.1.11/sendgrid-php.zip)**.

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

Previous versions of the library can be 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)

Include the proper lines from below at the top of each example based on your installation method:

```
