Closed
Description
Starting with a blank repo, run the following:
composer require guzzlehttp/guzzle
composer require php-http/guzzle6-adapter
composer require sparkpost/sparkpost
Then add this file:
<?php
require 'vendor/autoload.php';
use SparkPost\SparkPost;
use GuzzleHttp\Client;
use Http\Adapter\Guzzle6\Client as GuzzleAdapter;
$httpClient = new GuzzleAdapter(new Client());
$sparky = new SparkPost($httpClient, ['key'=>'8675309', 'async' => false]);
$payload = [
'content' => [
'subject' => 'Test',
'from' => [
'name' => 'Test Me',
'email' => 'test@example.com'
],
'html' => '<html><body>Test</body></html>'
],
'recipients' => [[
'address' => [
'email' => 'bob@example.com'
]
]]
];
$response = $sparky->transmissions->post($payload);
Then get this error:
Http\Discovery\NotFoundException: No message factories found. To use Guzzle or Diactoros factories install php-http/message and the chosen message implementation.
Metadata
Metadata
Assignees
Labels
No labels