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
Sparkpost requires php-http client (see [Setting up a Request Adapter](#setting-up-a-request-adapter)). There are several [providers](https://packagist.org/providers/php-http/client-implementation) available. If you were using guzzle6 your install might look like this.
27
27
28
28
```
29
-
composer require guzzlehttp/guzzle
30
-
composer require php-http/guzzle6-adapter
29
+
composer require php-http/guzzle6-adapter "^1.1"
30
+
composer require guzzlehttp/guzzle "^6.0"
31
31
```
32
32
33
33
Next, run the Composer command to install the SparkPost PHP Library:
@@ -43,7 +43,18 @@ require 'vendor/autoload.php';
43
43
use SparkPost\SparkPost;
44
44
```
45
45
46
-
**Note:** Without composer the costs outweight the benefits of using the PHP client library. A simple function like the one in [issue #164](https://github.com/SparkPost/php-sparkpost/issues/164#issuecomment-289888237) wraps the SparkPost API and makes it easy to use the API without resolving the composer dependencies.
46
+
**Note:** Without composer the costs outweigh the benefits of using the PHP client library. A simple function like the one in [issue #164](https://github.com/SparkPost/php-sparkpost/issues/164#issuecomment-289888237) wraps the SparkPost API and makes it easy to use the API without resolving the composer dependencies.
47
+
48
+
## Running with IDEs
49
+
50
+
When running with `xdebug` under an IDE such as VS Code, you may see an exception is thrown in file `vendor/php-http/discovery/src/Strategy/PuliBetaStrategy.php`:
51
+
52
+
```
53
+
Exception has occurred.
54
+
Http\Discovery\Exception\PuliUnavailableException: Puli Factory is not available
55
+
```
56
+
57
+
[This is usual](http://docs.php-http.org/en/latest/discovery.html#puli-factory-is-not-available). Puli is not required to use the library. You can resume running after the exception.
47
58
48
59
## Setting up a Request Adapter
49
60
@@ -179,44 +190,54 @@ use GuzzleHttp\Client;
179
190
use Http\Adapter\Guzzle6\Client as GuzzleAdapter;
180
191
181
192
$httpClient = new GuzzleAdapter(new Client());
182
-
$sparky = new SparkPost($httpClient, ['key'=>'YOUR_API_KEY']);
193
+
// Good practice to not have API key literals in code - set an environment variable instead
194
+
$sparky = new SparkPost($httpClient, ['key' => getenv('SPARKPOST_API_KEY')]);
0 commit comments