Skip to content

Commit

Permalink
Cleanup dependencies (#3)
Browse files Browse the repository at this point in the history
Thanks to @nicolas-grekas
  • Loading branch information
nicolas-grekas committed Apr 9, 2023
1 parent 2fece8c commit 60cd90f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
13 changes: 4 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
"type": "library",
"require": {
"php": "^7.4 || ^8.0",
"ext-json": "*",
"php-http/discovery": "^1.15",
"php-http/httplug": "^2.3",
"php-http/client-common": "^2.6",
"ext-json": "*"
"psr/http-client-implementation": "*",
"psr/http-factory-implementation": "*"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.16",
"guzzlehttp/guzzle": "^7.5",
"http-interop/http-factory-guzzle": "^1.2",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.5"
},
Expand All @@ -29,13 +28,9 @@
"email": "hello@joppe.dev"
}
],
"suggest": {
"guzzlehttp/guzzle": "Use Guzzle ^7 as HTTP client",
"http-interop/http-factory-guzzle": "Factory for guzzlehttp/guzzle"
},
"config": {
"allow-plugins": {
"php-http/discovery": true
"php-http/discovery": false
}
},
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions src/Http/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace JoppeDc\LogsnagPhpSdk\Http;

use Http\Discovery\Psr17FactoryDiscovery;
use Http\Discovery\Psr17Factory;
use Http\Discovery\Psr18ClientDiscovery;
use JoppeDc\LogsnagPhpSdk\Contracts\Http;
use JoppeDc\LogsnagPhpSdk\Exceptions\ApiException;
Expand Down Expand Up @@ -43,8 +43,8 @@ public function __construct(
$this->baseUrl = $url;
$this->apiKey = $apiKey;
$this->http = $httpClient ?? Psr18ClientDiscovery::find();
$this->requestFactory = $reqFactory ?? Psr17FactoryDiscovery::findRequestFactory();
$this->streamFactory = $streamFactory ?? Psr17FactoryDiscovery::findStreamFactory();
$this->requestFactory = $reqFactory ?? new Psr17Factory();
$this->streamFactory = $streamFactory ?? ($this->requestFactory instanceof StreamFactoryInterface ? $this->requestFactory : new Psr17Factory());

$this->headers = array_filter([
'User-Agent' => implode(';', array_merge($clientAgents, [Logsnag::qualifiedVersion()])),
Expand Down

0 comments on commit 60cd90f

Please sign in to comment.