Skip to content

As of 2.0.2, discovery can't find Guzzle #135

Closed
@danielsmithsd

Description

@danielsmithsd

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions