Closed
Description
I'm trying to create a small library usign php-http
.
Here the composer.json
{
"require": {
"php-http/message": "^1.2",
"php-http/client-common": "^1.1",
"php-http/discovery": "^0.8.0",
"puli/composer-plugin": "^1.0@beta,>=1.0.0-beta9"
},
"require-dev": {
"php-http/curl-client": "^1.4"
},
"minimum-stability": "beta"
}
I run composer install
and all vendors are installed
I've then created a simple demo.php
file with this code:
include_once('vendor/autoload.php');
use Http\Discovery\HttpClientDiscovery;
use Http\Discovery\MessageFactoryDiscovery;
$httpClient = HttpClientDiscovery::find();
echo get_class($httpClient);
but I get
PHP Catchable fatal error: Argument 1 passed to Http\Client\Curl\Client::__construct() must be an instance of Http\Message\MessageFactory, none given, called in /var/www/demo-library/vendor/php-http/discovery/src/HttpClientDiscovery.php on line 23 and defined in /var/www/demo-library/vendor/php-http/curl-client/src/Client.php on line 72
That seems correct because Http\Client\Curl\Client
is declared as
public function __construct(
MessageFactory $messageFactory,
StreamFactory $streamFactory,
array $options = []
) {
$this->messageFactory = $messageFactory;
$this->streamFactory = $streamFactory;
$this->options = $options;
}
Am I doing something wrong ?
Metadata
Metadata
Assignees
Labels
No labels