blob: 20e09124ee990863542b9ee4261e4f74f89a9f66 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
<?php
/**
* This library allows you to quickly and easily send emails through SendGrid using PHP.
*
* PHP version 5.3
*
* @author Elmer Thomas <dx@sendgrid.com>
* @copyright 2016 SendGrid
* @license https://opensource.org/licenses/MIT The MIT License
* @version GIT: <git_id>
* @link http://packagist.org/packages/sendgrid/sendgrid
*/
/**
* Interface to the SendGrid Web API
*/
class SendGrid
{
const VERSION = '5.1.2';
/**
*
* @var string
*/
protected $namespace = 'SendGrid';
/**
* @var \SendGrid\Client
*/
public $client;
/**
* @var string
*/
public $version = self::VERSION;
/**
* Setup the HTTP Client
*
* @param string $apiKey your SendGrid API Key.
* @param array $options an array of options, currently only "host" is implemented.
*/
public function __construct($apiKey, $options = array())
{
$headers = array(
'Authorization: Bearer '.$apiKey,
'User-Agent: sendgrid/' . $this->version . ';php',
'Accept: application/json'
);
$host = isset($options['host']) ? $options['host'] : 'https://api.sendgrid.com';
$this->client = new \SendGrid\Client($host, $headers, '/v3', null);
}
}
|