Skip to content
This repository was archived by the owner on Jan 6, 2024. It is now read-only.

Commit 0920dd9

Browse files
committed
Merge pull request #18 from php-http/discovery
Remove hard discovery dependency
2 parents 5a9d514 + e5e870e commit 0920dd9

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# Change Log
22

33

4+
## UNRELEASED
5+
6+
### Removed
7+
8+
- Hard discovery dependency
9+
10+
411
## 0.3.0 - 2016-01-21
512

613
### Changed

composer.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,18 @@
1717
"require": {
1818
"php": ">=5.4",
1919
"php-http/httplug": "^1.0",
20-
"php-http/discovery": "^0.7",
2120
"guzzlehttp/guzzle": "^5.1"
2221
},
2322
"require-dev": {
2423
"ext-curl": "*",
2524
"php-http/adapter-integration-tests": "^0.3",
2625
"guzzlehttp/ringphp": "^1.1",
2726
"php-http/client-common": "^0.1.1",
28-
"guzzlehttp/psr7": "^1.2"
27+
"guzzlehttp/psr7": "^1.2",
28+
"php-http/discovery": "^0.7"
29+
},
30+
"suggest": {
31+
"php-http/discovery": "Used for message factory discovery"
2932
},
3033
"provide": {
3134
"php-http/client-implementation": "1.0"

src/Client.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ class Client implements HttpClient
3636
*/
3737
public function __construct(ClientInterface $client = null, MessageFactory $messageFactory = null)
3838
{
39+
if (null === $messageFactory and false === class_exists('Http\Discovery\MessageFactoryDiscovery')) {
40+
throw new \LogicException('No message factory provided and no discovery service is present to guess it, maybe you need to install php-http/discovery package?');
41+
}
42+
3943
$this->client = $client ?: new GuzzleClient();
4044
$this->messageFactory = $messageFactory ?: MessageFactoryDiscovery::find();
4145
}

0 commit comments

Comments
 (0)