summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElmer Thomas <elmer@thinkingserious.com>2016-06-13 14:59:15 -0700
committerElmer Thomas <elmer@thinkingserious.com>2016-06-13 14:59:15 -0700
commit75b0cb25a07314c99fe91d504c5ebaca38f2aaf4 (patch)
treeb12805a79484522f0ff5d75f1c5fa9e02d64208d
parent078d38b5399eddd80406d07e1b3f4b5cb24f522d (diff)
downloadsendgrid-php-75b0cb25a07314c99fe91d504c5ebaca38f2aaf4.zip
sendgrid-php-75b0cb25a07314c99fe91d504c5ebaca38f2aaf4.tar.gz
sendgrid-php-75b0cb25a07314c99fe91d504c5ebaca38f2aaf4.tar.bz2
Version Bump v5.0.0: full v3 Web API support
-rw-r--r--CHANGELOG.md2
-rw-r--r--CONTRIBUTING.md12
-rw-r--r--README.md74
-rw-r--r--USAGE.md8
-rw-r--r--examples/helpers/mail/example.php6
-rw-r--r--examples/mail/mail.php144
-rw-r--r--lib/helpers/mail/README.md4
7 files changed, 105 insertions, 145 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c34a963..9c82bc7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
-## [5.0.0] - XXXX-XX-XX
+## [5.0.0] - 2016-06-13 ##
### Added
- Breaking change to support the v3 Web API
- New HTTP client
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 1143a12..07c5b38 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -89,13 +89,9 @@ source ./sendgrid.env
##### Execute: #####
-See the [examples folder](https://github.com/sendgrid/sendgrid-php/tree/v3beta/examples) to get started quickly.
+See the [examples folder](https://github.com/sendgrid/sendgrid-php/tree/master/examples) to get started quickly.
-From the root directory of this repo, replace `require 'vendor/autoload.php';` with:
-```php
-require './vendor/autoload.php';
-require './lib/SendGrid.php';
-```
+If you are using composer, replace <PATH_TO> with the path to your `vendor/autoload.php`. Otherwise, include lib/SendGrid.php and lib/helpers/mail/Mail.php.
<a name="understanding_the_codebase"></a>
## Understanding the Code Base
@@ -121,9 +117,9 @@ The interface to the SendGrid API.
All PRs require passing tests before the PR will be reviewed.
-All test files are in the [`/test/unit`](https://github.com/sendgrid/sendgrid-php/tree/v3beta/test/unit) directory.
+All test files are in the [`/test/unit`](https://github.com/sendgrid/sendgrid-php/tree/master/test/unit) directory.
-For the purposes of contributing to this repo, please update the [`SendGridTest.php`](https://github.com/sendgrid/sendgrid-php/tree/v3beta/test/unit/SendGridTest.php) file with unit tests as you modify the code.
+For the purposes of contributing to this repo, please update the [`SendGridTest.php`](https://github.com/sendgrid/sendgrid-php/tree/master/test/unit/SendGridTest.php) file with unit tests as you modify the code.
```bash
cd test/unit
diff --git a/README.md b/README.md
index 4541e11..d54ad59 100644
--- a/README.md
+++ b/README.md
@@ -1,18 +1,10 @@
-[![BuildStatus](https://travis-ci.org/sendgrid/sendgrid-php.svg?branch=v3beta)](https://travis-ci.org/sendgrid/sendgrid-php)
+[![BuildStatus](https://travis-ci.org/sendgrid/sendgrid-php.svg?branch=master)](https://travis-ci.org/sendgrid/sendgrid-php)
**This library allows you to quickly and easily use the SendGrid Web API via PHP.**
# Announcements
-**NOTE: The `/mail/send/beta` endpoint is currently in beta!
-
-Since this is not a general release, we do not recommend POSTing production level traffic through this endpoint or integrating your production servers with this endpoint.
-
-When this endpoint is ready for general release, your code will require an update in order to use the official URI.
-
-By using this endpoint, you accept that you may encounter bugs and that the endpoint may be taken down for maintenance at any time. We cannot guarantee the continued availability of this beta endpoint. We hope that you like this new endpoint and we appreciate any [feedback](dx+mail-beta@sendgrid.com) that you can send our way.**
-
-**BREAKING CHANGE as of XXXX.XX.XX**
+**BREAKING CHANGE as of 2016.06.14**
Version `5.0.0` is a breaking change for the entire library.
@@ -22,15 +14,17 @@ have the following resources to get you started quickly:
- [SendGrid
Documentation](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html)
- [Usage
- Documentation](https://github.com/sendgrid/sendgrid-php/tree/v3beta/USAGE.md)
+ Documentation](https://github.com/sendgrid/sendgrid-php/tree/master/USAGE.md)
- [Example
- Code](https://github.com/sendgrid/sendgrid-php/tree/v3beta/examples)
+ Code](https://github.com/sendgrid/sendgrid-php/tree/master/examples)
+
+Thank you for your continued support!
-All updates to this library is documented in our [CHANGELOG](https://github.com/sendgrid/sendgrid-php/blob/v3beta/CHANGELOG.md).
+All updates to this library is documented in our [CHANGELOG](https://github.com/sendgrid/sendgrid-php/blob/master/CHANGELOG.md).
# Installation
-## Environment Variables
+## Setup Environment Variables
First, get your free SendGrid account [here](https://sendgrid.com/free?source=sendgrid-php).
@@ -42,37 +36,7 @@ echo "sendgrid.env" >> .gitignore
source ./sendgrid.env
```
-## TRYING OUT THE V3 BETA MAIL SEND
-
-```bash
-git clone -b v3beta --single-branch https://github.com/sendgrid/sendgrid-php.git
-cd sendgrid-php
-composer install
-```
-
-* Update the to and from [emails](https://github.com/sendgrid/sendgrid-php/blob/v3beta/examples/helpers/mail/example.php#L11).
-
-```bash
-php examples/helpers/mail/example.php
-```
-
-* Check out the documentation for [Web API v3 /mail/send/beta endpoint](https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/index.html).
-
-## TRYING OUT THE V3 BETA WEB API
-
-```bash
-git clone -b v3beta --single-branch https://github.com/sendgrid/sendgrid-php.git
-```
-
-* Check out the documentation for [Web API v3 endpoints](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html).
-* Review the corresponding [examples](https://github.com/sendgrid/sendgrid-php/blob/v3beta/examples).
-* From the root directory of this repo, replace `require 'vendor/autoload.php';` with:
-```php
-require './vendor/autoload.php';
-require './lib/SendGrid.php';
-```
-
-## Once we are out of v3 BETA, the following will apply
+## Install Package
Add SendGrid to your `composer.json` file. If you are not using [Composer](http://getcomposer.org), you should be. It's an excellent way to manage dependencies in your PHP application.
@@ -90,7 +54,7 @@ Then at the top of your PHP script require the autoloader:
require 'vendor/autoload.php';
```
-#### Alternative: Install 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://sendgrid-open-source.s3.amazonaws.com/sendgrid-php/sendgrid-php.zip)**.
@@ -126,7 +90,7 @@ $mail = new Mail($from, $subject, $to, $content);
$apiKey = getenv('SENDGRID_API_KEY');
$sg = new \SendGrid($apiKey);
-$response = $sg->client->mail()->send()->beta()->post($mail);
+$response = $sg->client->mail()->send()->post($mail);
echo $response->statusCode();
echo $response->headers();
echo $response->body();
@@ -152,9 +116,9 @@ print $response->body();
- [SendGrid Docs](https://sendgrid.com/docs/API_Reference/index.html)
- [Usage
- Documentation](https://github.com/sendgrid/sendgrid-php/tree/v3beta/USAGE.md)
-- [Example Code](https://github.com/sendgrid/sendgrid-php/tree/v3beta/examples)
-- [v3 Web API Mail Send Helper](https://github.com/sendgrid/sendgrid-php/tree/v3beta/lib/helpers/mail/README.md) - build a request object payload for a v3 /mail/send API call.
+ Documentation](https://github.com/sendgrid/sendgrid-php/tree/master/USAGE.md)
+- [Example Code](https://github.com/sendgrid/sendgrid-php/tree/master/examples)
+- [v3 Web API Mail Send Helper](https://github.com/sendgrid/sendgrid-php/tree/master/lib/helpers/mail/README.md) - build a request object payload for a v3 /mail/send API call.
## Roadmap
@@ -162,14 +126,14 @@ If you are intersted in the future direction of this project, please take a look
## How to Contribute
-We encourage contribution to our libraries, please see our [CONTRIBUTING](https://github.com/sendgrid/sendgrid-php/blob/v3beta/CONTRIBUTING.md) guide for details.
+We encourage contribution to our libraries, please see our [CONTRIBUTING](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md) guide for details.
Quick links:
-- [Feature Request](https://github.com/sendgrid/sendgrid-php/blob/v3beta/CONTRIBUTING.md#feature_request)
-- [Bug Reports](https://github.com/sendgrid/sendgrid-php/blob/v3beta/CONTRIBUTING.md#submit_a_bug_report)
-- [Sign the CLA to Create a Pull Request](https://github.com/sendgrid/sendgrid-php/blob/v3beta/CONTRIBUTING.md#cla)
-- [Improvements to the Codebase](https://github.com/sendgrid/sendgrid-php/blob/v3beta/CONTRIBUTING.md#improvements_to_the_codebase)
+- [Feature Request](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md#feature_request)
+- [Bug Reports](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md#submit_a_bug_report)
+- [Sign the CLA to Create a Pull Request](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md#cla)
+- [Improvements to the Codebase](https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md#improvements_to_the_codebase)
# About
diff --git a/USAGE.md b/USAGE.md
index 9771e32..e5d625c 100644
--- a/USAGE.md
+++ b/USAGE.md
@@ -1936,7 +1936,7 @@ echo $response->statusCode();
echo $response->body();
echo $response->headers();
```
-## v3 Mail Send Beta
+## v3 Mail Send
This endpoint allows you to send email over SendGrids v3 Web API, the most recent version of our API. If you are looking for documentation about the v2 Mail Send endpoint, please see our [v2 API Reference](https://sendgrid.com/docs/API_Reference/Web_API/mail.html).
@@ -1947,9 +1947,9 @@ For an overview of the v3 Mail Send endpoint, please visit our [v3 API Reference
For more detailed information about how to use the v3 Mail Send endpoint, please visit our [Classroom](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/index.html).
-### POST /mail/send/beta
+### POST /mail/send
-This endpoint has a helper, check it out [here](https://github.com/sendgrid/sendgrid-php/blob/v3beta/lib/helpers/mail/README.md).
+This endpoint has a helper, check it out [here](https://github.com/sendgrid/sendgrid-php/blob/master/lib/helpers/mail/README.md).
```php
$request_body = json_decode('{
@@ -2095,7 +2095,7 @@ $request_body = json_decode('{
}
}
}');
-$response = $sg->client->mail()->send()->beta()->post($request_body);
+$response = $sg->client->mail()->send()->post($request_body);
echo $response->statusCode();
echo $response->body();
echo $response->headers();
diff --git a/examples/helpers/mail/example.php b/examples/helpers/mail/example.php
index ce3f062..678302d 100644
--- a/examples/helpers/mail/example.php
+++ b/examples/helpers/mail/example.php
@@ -2,7 +2,7 @@
namespace SendGrid;
// If you are using Composer
-require __DIR__ . '/../../../vendor/autoload.php';
+require __DIR__ . '<PATH_TO>/vendor/autoload.php';
function helloEmail()
@@ -182,7 +182,7 @@ function sendHelloEmail()
$sg = new \SendGrid($apiKey);
$request_body = helloEmail();
- $response = $sg->client->mail()->send()->beta()->post($request_body);
+ $response = $sg->client->mail()->send()->post($request_body);
echo $response->statusCode();
echo $response->body();
echo $response->headers();
@@ -194,7 +194,7 @@ function sendKitchenSink()
$sg = new \SendGrid($apiKey);
$request_body = kitchenSink();
- $response = $sg->client->mail()->send()->beta()->post($request_body);
+ $response = $sg->client->mail()->send()->post($request_body);
echo $response->statusCode();
echo $response->body();
echo $response->headers();
diff --git a/examples/mail/mail.php b/examples/mail/mail.php
index ea57555..a65368d 100644
--- a/examples/mail/mail.php
+++ b/examples/mail/mail.php
@@ -27,154 +27,154 @@ echo $response->body();
echo $response->headers();
////////////////////////////////////////////////////
-// v3 Mail Send Beta #
-// POST /mail/send/beta #
-// This endpoint has a helper, check it out [here](https://github.com/sendgrid/sendgrid-php/blob/v3beta/lib/helpers/mail/README.md).
+// v3 Mail Send #
+// POST /mail/send #
+// This endpoint has a helper, check it out [here](https://github.com/sendgrid/sendgrid-php/blob/master/lib/helpers/mail/README.md).
$request_body = json_decode('{
"asm": {
- "group_id": 1,
+ "group_id": 1,
"groups_to_display": [
- 1,
- 2,
+ 1,
+ 2,
3
]
- },
+ },
"attachments": [
{
- "content": "[BASE64 encoded content block here]",
- "content_id": "ii_139db99fdb5c3704",
- "disposition": "inline",
- "filename": "file1.jpg",
- "name": "file1",
+ "content": "[BASE64 encoded content block here]",
+ "content_id": "ii_139db99fdb5c3704",
+ "disposition": "inline",
+ "filename": "file1.jpg",
+ "name": "file1",
"type": "jpg"
}
- ],
- "batch_id": "[YOUR BATCH ID GOES HERE]",
+ ],
+ "batch_id": "[YOUR BATCH ID GOES HERE]",
"categories": [
- "category1",
+ "category1",
"category2"
- ],
+ ],
"content": [
{
- "type": "text/html",
+ "type": "text/html",
"value": "<html><p>Hello, world!</p><img src=[CID GOES HERE]></img></html>"
}
- ],
+ ],
"custom_args": {
- "New Argument 1": "New Value 1",
- "activationAttempt": "1",
+ "New Argument 1": "New Value 1",
+ "activationAttempt": "1",
"customerAccountNumber": "[CUSTOMER ACCOUNT NUMBER GOES HERE]"
- },
+ },
"from": {
- "email": "sam.smith@example.com",
+ "email": "sam.smith@example.com",
"name": "Sam Smith"
- },
- "headers": {},
- "ip_pool_name": "[YOUR POOL NAME GOES HERE]",
+ },
+ "headers": {},
+ "ip_pool_name": "[YOUR POOL NAME GOES HERE]",
"mail_settings": {
"bcc": {
- "email": "ben.doe@example.com",
+ "email": "ben.doe@example.com",
"enable": true
- },
+ },
"bypass_list_management": {
"enable": true
- },
+ },
"footer": {
- "enable": true,
- "html": "<p>Thanks</br>The SendGrid Team</p>",
+ "enable": true,
+ "html": "<p>Thanks</br>The SendGrid Team</p>",
"text": "Thanks,/n The SendGrid Team"
- },
+ },
"sandbox_mode": {
"enable": false
- },
+ },
"spam_check": {
- "enable": true,
- "post_to_url": "http://example.com/compliance",
+ "enable": true,
+ "post_to_url": "http://example.com/compliance",
"threshold": 3
}
- },
+ },
"personalizations": [
{
"bcc": [
{
- "email": "sam.doe@example.com",
+ "email": "sam.doe@example.com",
"name": "Sam Doe"
}
- ],
+ ],
"cc": [
{
- "email": "jane.doe@example.com",
+ "email": "jane.doe@example.com",
"name": "Jane Doe"
}
- ],
+ ],
"custom_args": {
- "New Argument 1": "New Value 1",
- "activationAttempt": "1",
+ "New Argument 1": "New Value 1",
+ "activationAttempt": "1",
"customerAccountNumber": "[CUSTOMER ACCOUNT NUMBER GOES HERE]"
- },
+ },
"headers": {
- "X-Accept-Language": "en",
+ "X-Accept-Language": "en",
"X-Mailer": "MyApp"
- },
- "send_at": 1409348513,
- "subject": "Hello, World!",
+ },
+ "send_at": 1409348513,
+ "subject": "Hello, World!",
"substitutions": {
"sub": {
"%name%": [
- "John",
- "Jane",
+ "John",
+ "Jane",
"Sam"
]
}
- },
+ },
"to": [
{
- "email": "john.doe@example.com",
+ "email": "john.doe@example.com",
"name": "John Doe"
}
]
}
- ],
+ ],
"reply_to": {
- "email": "sam.smith@example.com",
+ "email": "sam.smith@example.com",
"name": "Sam Smith"
- },
+ },
"sections": {
"section": {
- ":sectionName1": "section 1 text",
+ ":sectionName1": "section 1 text",
":sectionName2": "section 2 text"
}
- },
- "send_at": 1409348513,
- "subject": "Hello, World!",
- "template_id": "[YOUR TEMPLATE ID GOES HERE]",
+ },
+ "send_at": 1409348513,
+ "subject": "Hello, World!",
+ "template_id": "[YOUR TEMPLATE ID GOES HERE]",
"tracking_settings": {
"click_tracking": {
- "enable": true,
+ "enable": true,
"enable_text": true
- },
+ },
"ganalytics": {
- "enable": true,
- "utm_campaign": "[NAME OF YOUR REFERRER SOURCE]",
- "utm_content": "[USE THIS SPACE TO DIFFERENTIATE YOUR EMAIL FROM ADS]",
- "utm_medium": "[NAME OF YOUR MARKETING MEDIUM e.g. email]",
- "utm_name": "[NAME OF YOUR CAMPAIGN]",
+ "enable": true,
+ "utm_campaign": "[NAME OF YOUR REFERRER SOURCE]",
+ "utm_content": "[USE THIS SPACE TO DIFFERENTIATE YOUR EMAIL FROM ADS]",
+ "utm_medium": "[NAME OF YOUR MARKETING MEDIUM e.g. email]",
+ "utm_name": "[NAME OF YOUR CAMPAIGN]",
"utm_term": "[IDENTIFY PAID KEYWORDS HERE]"
- },
+ },
"open_tracking": {
- "enable": true,
+ "enable": true,
"substitution_tag": "%opentrack"
- },
+ },
"subscription_tracking": {
- "enable": true,
- "html": "If you would like to unsubscribe and stop receiving these emails <% clickhere %>.",
- "substitution_tag": "<%click here%>",
+ "enable": true,
+ "html": "If you would like to unsubscribe and stop receiving these emails <% clickhere %>.",
+ "substitution_tag": "<%click here%>",
"text": "If you would like to unsubscribe and stop receiveing these emails <% click here %>."
}
}
}');
-$response = $sg->client->mail()->send()->beta()->post($request_body);
+$response = $sg->client->mail()->send()->post($request_body);
echo $response->statusCode();
echo $response->body();
echo $response->headers();
diff --git a/lib/helpers/mail/README.md b/lib/helpers/mail/README.md
index 5063bdb..f0e4746 100644
--- a/lib/helpers/mail/README.md
+++ b/lib/helpers/mail/README.md
@@ -2,7 +2,7 @@
# Quick Start
-Run the [example](https://github.com/sendgrid/sendgrid-php/tree/v3beta/examples/helpers/mail) (make sure you have set your environment variable to include your SENDGRID_API_KEY).
+Run the [example](https://github.com/sendgrid/sendgrid-php/tree/master/examples/helpers/mail) (make sure you have set your environment variable to include your SENDGRID_API_KEY).
```bash
php examples/helpers/mail/example.php
@@ -10,5 +10,5 @@ php examples/helpers/mail/example.php
## Usage
-- See the [example](https://github.com/sendgrid/sendgrid-php/tree/v3beta/examples) for a complete working example.
+- See the [example](https://github.com/sendgrid/sendgrid-php/tree/master/examples) for a complete working example.
- [Documentation](https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/overview.html) \ No newline at end of file