$client = new Client(['base_uri' => 'http://api.tvmaze.com/']);
$res = $client->request('GET', '/schedule?country=US&date=2014-12-01');
return $res;
returns this error:
"Class 'Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory' not found"
I've tried including "symfony/psr-http-message-bridge": "0.2", in my composer.json file
Remove guzzle package first : composer remove guzzlehttp/guzzle
then do:
composer dump-autoload
finally re install it:
composer require guzzlehttp/guzzle
Also make sure you are using guzzle namespace:
use GuzzleHttp\Client;
You are instantiating a Client but seems like you weren't explicit with the class being instantiated. Try this:
$client = new \GuzzleHttp\Client(['base_uri' => 'http://api.tvmaze.com/']);
$res = $client->request('GET', '/schedule?country=US&date=2014-12-01');
return $res;
That's a bit old question. However, since the answers couldn't resolve it for me, here is a last thing to try when using Guzzle Http.
According to Laravel Documentation https://laravel.com/docs/5.3/requests#psr7-requests :
The PSR-7 standard specifies interfaces for HTTP messages, including requests and responses. If you would like to obtain an instance of a PSR-7 request instead of a Laravel request, you will first need to install a few libraries. Laravel uses the Symfony HTTP Message Bridge component to convert typical Laravel requests and responses into PSR-7 compatible implementations:
composer require symfony/psr-http-message-bridge
composer require zendframework/zend-diactoros
This solved my problem.