You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+49-18Lines changed: 49 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,36 +19,67 @@ Next, run the Composer command to install the SparkPost PHP SDK:
19
19
composer require sparkpost/php-sparkpost
20
20
```
21
21
After installing, you need to require Composer's autoloader:
22
-
```
22
+
```php
23
23
require 'vendor/autoload.php';
24
24
use SparkPost\SparkPost;
25
25
```
26
26
27
-
## Getting Started: Your First Mailing
27
+
## Setting up a Request Adapter
28
+
Because of dependency collision, we have opted to use a request adapter rather than
29
+
requiring a request library. This means that your application will need to pass in
30
+
a request adapter to the constructor of the SparkPost Library. We use the [Ivory HTTP Adapter] (https://github.com/egeloen/ivory-http-adapter) in SparkPost. Please visit their repo
31
+
for a list of supported adapters. If you don't currently use a request library, you will
32
+
need to require one and create an adapter from it and pass it along. The example below uses the
33
+
GuzzleHttp Client Library.
34
+
35
+
An Adapter can be setup like so:
36
+
```php
37
+
use SparkPost\SparkPost;
38
+
use GuzzleHttp\Client;
39
+
use Ivory\HttpAdapter\Guzzle6HttpAdapter;
40
+
41
+
$httpAdapter = new Guzzle6HttpAdapter(new Client());
42
+
$sparky = new SparkPost($httpAdapter, ['key'=>'YOUR API KEY']);
28
43
```
29
-
SparkPost::setConfig(["key"=>"YOUR API KEY"]);
44
+
45
+
## Getting Started: Your First Mailing
46
+
```php
47
+
require 'vendor/autoload.php';
48
+
49
+
use SparkPost\SparkPost;
50
+
use GuzzleHttp\Client;
51
+
use Ivory\HttpAdapter\Guzzle6HttpAdapter;
52
+
53
+
$httpAdapter = new Guzzle6HttpAdapter(new Client());
54
+
$sparky = new SparkPost($httpAdapter, ['key'=>'YOUR API KEY']);
0 commit comments