Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
danielsmithsd opened this issue Jul 28, 2016 · 1 comment
Closed

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

danielsmithsd opened this issue Jul 28, 2016 · 1 comment

Comments

@danielsmithsd
Copy link

danielsmithsd commented Jul 28, 2016

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.
@avigoldman
Copy link
Contributor

Hey @danielsmithsd thanks for pointing this out. As a quick fix you can include php-http/message: ^1.0 in your composer file. I'm going to push out version 2.0.3 that adds this composer requirement to the package.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants