Skip to content

Commit

Permalink
Remove testing against Guzzle 5
Browse files Browse the repository at this point in the history
Neither it nor the HttpPlug adapter is maintained upstream anymore:
https://github.com/php-http/guzzle5-adapter#deprecated

It also does not support async requests which we want to use eventually.

Since trying to install the it in CI now causes dependency conflicts,
let’s just stop supporting it like we did with Guzzle 6.
  • Loading branch information
jtojnar committed Sep 30, 2024
1 parent cd13fbb commit 49939fb
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 65 deletions.
39 changes: 0 additions & 39 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,45 +131,6 @@ jobs:
- name: "Run PHPUnit"
run: "php vendor/bin/simple-phpunit -v"

phpunit-guzzle5:
name: "PHPUnit (PHP ${{ matrix.php }} and Guzzle 5)"
runs-on: "ubuntu-20.04"

strategy:
matrix:
php:
- "7.4"

steps:
- name: "Checkout"
uses: "actions/checkout@v4"
with:
fetch-depth: 2

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php }}"
coverage: "none"
tools: composer:v2
extensions: tidy
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"

- name: "Setup adapter: Guzzle 5"
run: |
composer remove guzzlehttp/guzzle php-http/guzzle7-adapter --dev -n
composer require php-http/guzzle5-adapter --dev -n
- name: "Setup logs"
run: "mkdir -p build/logs"

- name: "Run PHPUnit"
run: "php vendor/bin/simple-phpunit -v"

phpunit-curl:
name: "PHPUnit (PHP ${{ matrix.php }} and cURL)"
runs-on: "ubuntu-20.04"
Expand Down
17 changes: 1 addition & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@ Why `php-http/guzzle7-adapter`? Because Graby is decoupled from any HTTP client
Graby is tested & should work great with:

- Guzzle 7 (using `php-http/guzzle7-adapter`)
- Guzzle 5 (using `php-http/guzzle5-adapter`)
- cURL (using `php-http/curl-client`)

Note: if you want to use Guzzle 6, use Graby 2 (support has dropped in v3 because of dependencies conflicts, which does not happen with Guzzle 5 :shrug:)
Note: if you want to use Guzzle 5 or 6, use Graby 2 (support has dropped in v3 because of dependencies conflicts)

### Retrieve content from an url

Expand Down Expand Up @@ -193,20 +192,6 @@ $logs = $this->get('monolog.handler.graby')->getRecords();
If you need to define a timeout, you must create the `Http\Client\HttpClient` manually,
configure it and inject it to `Graby\Graby`.

- For Guzzle 5:

```php
use Graby\Graby;
use GuzzleHttp\Client as GuzzleClient;
use Http\Adapter\Guzzle5\Client as GuzzleAdapter;
$guzzle = new GuzzleClient([
'defaults' => [
'timeout' => 2,
]
]);
$graby = new Graby([], new GuzzleAdapter($guzzle));
```

- For Guzzle 7:

```php
Expand Down
4 changes: 2 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ parameters:
- vendor/bin/.phpunit/phpunit/vendor/autoload.php

ignoreErrors:
# because we check for some HTTP client to exist or not (Guzzle 5/6 & cURL)
# because we check for some HTTP client to exist or not (cURL)
-
message: '#Http\\Adapter\\Guzzle5\\Client\\|Http\\Adapter\\Guzzle6\\Client\\|Http\\Client\\Curl\\Client given#'
message: '#Http\\Client\\Curl\\Client given#'
path: %currentWorkingDirectory%/tests/Extractor/HttpClientTest.php
# phpstan does not seem to recognize the class override for JSLikeHTMLElement
-
Expand Down
8 changes: 0 additions & 8 deletions tests/Extractor/HttpClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,6 @@ public function testTimeout(): void
$isGuzzle = true;
$guzzle = new \GuzzleHttp\Client(['timeout' => 2]);
$adapter = new \Http\Adapter\Guzzle7\Client($guzzle);
} elseif (class_exists('Http\Adapter\Guzzle6\Client')) {
$isGuzzle = true;
$guzzle = new \GuzzleHttp\Client(['timeout' => 2]);
$adapter = new \Http\Adapter\Guzzle6\Client($guzzle);
} elseif (class_exists('Http\Adapter\Guzzle5\Client')) {
$isGuzzle = true;
$guzzle = new \GuzzleHttp\Client(['defaults' => ['timeout' => 2]]);
$adapter = new \Http\Adapter\Guzzle5\Client($guzzle);
} elseif (class_exists('Http\Client\Curl\Client')) {
$isCurl = true;
$adapter = new \Http\Client\Curl\Client(
Expand Down

0 comments on commit 49939fb

Please sign in to comment.