Subversion Repositories cheapmusic

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
103 - 1
If you have a non-library SendGrid issue, please contact our [support team](https://support.sendgrid.com).
2
 
3
If you can't find a solution below, please open an [issue](https://github.com/sendgrid/sendgrid-php/issues).
4
 
5
 
6
## Table of Contents
7
 
8
* [Migrating from v2 to v3](#migrating)
9
* [Continue Using v2](#v2)
10
* [Testing v3 /mail/send Calls Directly](#testing)
11
* [Error Messages](#error)
12
* [Versions](#versions)
13
* [Environment Variables and Your SendGrid API Key](#environment)
14
* [Using the Package Manager](#package-manager)
15
 
16
<a name="migrating"></a>
17
## Migrating from v2 to v3
18
 
19
Please review [our guide](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/how_to_migrate_from_v2_to_v3_mail_send.html) on how to migrate from v2 to v3.
20
 
21
<a name="v2"></a>
22
## Continue Using v2
23
 
24
[Here](https://github.com/sendgrid/sendgrid-php/tree/75970eb82f5629e66db4d6da08ff7ef0c507e9b0) is the last working version with v2 support.
25
 
26
Using composer:
27
 
28
```json
29
{
30
  "require": {
31
    "sendgrid/sendgrid": "~3.2"
32
  }
33
}
34
```
35
 
36
Download packaged zip [here](https://sendgrid-open-source.s3.amazonaws.com/sendgrid-php/versions/sendgrid-php-75970eb.zip).
37
 
38
<a name="testing"></a>
39
## Testing v3 /mail/send Calls Directly
40
 
41
[Here](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/curl_examples.html) are some cURL examples for common use cases.
42
 
43
<a name="error"></a>
44
## Error Messages
45
 
46
To read the error message returned by SendGrid's API:
47
 
48
```php
49
try {
50
    $response = $sendgrid->client->mail()->send()->post($mail);
51
} catch (Exception $e) {
52
    echo 'Caught exception: ',  $e->getMessage(), "\n";
53
}
54
```
55
 
56
<a name="versions"></a>
57
## Versions
58
 
59
We follow the MAJOR.MINOR.PATCH versioning scheme as described by [SemVer.org](http://semver.org). Therefore, we recommend that you always pin (or vendor) the particular version you are working with to your code and never auto-update to the latest version. Especially when there is a MAJOR point release, since that is guarenteed to be a breaking change. Changes are documented in the [CHANGELOG](https://github.com/sendgrid/sendgrid-php/blob/master/CHANGELOG.md) and [releases](https://github.com/sendgrid/sendgrid-php/releases) section.
60
 
61
<a name="environment"></a>
62
## Environment Variables and Your SendGrid API Key
63
 
64
All of our examples assume you are using [environment variables](https://github.com/sendgrid/sendgrid-php#setup-environment-variables) to hold your SendGrid API key.
65
 
66
If you choose to add your SendGrid API key directly (not recommended):
67
 
68
`$apiKey = getenv('SENDGRID_API_KEY');`
69
 
70
becomes
71
 
72
`$apiKey = 'SENDGRID_API_KEY';`
73
 
74
In the first case SENDGRID_API_KEY is in reference to the name of the environment variable, while the second case references the actual SendGrid API Key.
75
 
76
<a name="package-manager"></a>
77
## Using the Package Manager
78
 
79
We upload this library to [Packagist](https://packagist.org/packages/sendgrid/sendgrid) whenever we make a release. This allows you to use [composer](https://getcomposer.org) for easy installation.
80
 
81
In most cases we recommend you download the latest version of the library, but if you need a different version, please use:
82
 
83
```json
84
{
85
  "require": {
86
    "sendgrid/sendgrid": "~X.X.X"
87
  }
88
}
89
```