From 7d5310f4366c431bd31a24c3e9dabe5f746d8465 Mon Sep 17 00:00:00 2001 From: Nadar Date: Tue, 31 Oct 2023 07:29:14 +0000 Subject: [PATCH 1/6] make json extension required closes #81 --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f6fce1c..6608e2e 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,8 @@ ], "require": { "php": "^5.6 | ^7.0 | ^8.0", - "ext-curl": "*" + "ext-curl": "*", + "ext-json": "*" }, "require-dev": { "yoast/phpunit-polyfills": "^0.2.0" From d48a4fd0a250c9fe0e8ff77add151f8675445dfc Mon Sep 17 00:00:00 2001 From: Nadar Date: Tue, 31 Oct 2023 07:29:33 +0000 Subject: [PATCH 2/6] php 8.0 min requirement --- .github/workflows/tests.yml | 8 ++++---- README.md | 6 ------ composer.json | 2 +- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b9d614d..2a47e16 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -66,12 +66,12 @@ jobs: ## run unit tests - name: PHP Unit tests for PHP run: vendor/bin/phpunit --verbose --configuration actions.phpunit.xml - if: matrix.php == '8.3' || matrix.php == '8.2' || matrix.php == '8.1' || matrix.php == '8.0' || matrix.php == '7.4' || matrix.php == '7.3' || matrix.php == '7.2' || matrix.php == '7.0' || matrix.php == '5.6' + if: matrix.php == '8.3' || matrix.php == '8.2' || matrix.php == '8.1' ## unit test with coverage - - name: PHP Unit tests for PHP 7.1 + - name: PHP Unit tests for PHP 8.0 run: vendor/bin/phpunit --verbose --coverage-clover=clover.xml --configuration actions.phpunit.xml - if: matrix.php == '7.1' + if: matrix.php == '8.0' ## coverage - name: Code coverage @@ -79,5 +79,5 @@ jobs: curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter chmod +x ./cc-test-reporter ./cc-test-reporter after-build -t clover - if: matrix.php == '7.1' + if: matrix.php == '8.0' continue-on-error: true # if is fork diff --git a/README.md b/README.md index 58e4236..85cfcd1 100644 --- a/README.md +++ b/README.md @@ -17,12 +17,6 @@ In order to install this library via composer run the following command in the c composer require curl/curl ``` -or add the package manually to your composer.json file in the require section: - -```json -"curl/curl": "^2.0" -``` - ## Usage examples A few example for using CURL with get: diff --git a/composer.json b/composer.json index 6608e2e..dc4bde8 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ } ], "require": { - "php": "^5.6 | ^7.0 | ^8.0", + "php": "^8.0", "ext-curl": "*", "ext-json": "*" }, From bee7474cb6db6aacedd15aa68051ac64084961ff Mon Sep 17 00:00:00 2001 From: Nadar Date: Tue, 31 Oct 2023 07:32:30 +0000 Subject: [PATCH 3/6] remove old php versions --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2a47e16..0df400b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -37,7 +37,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3'] + php: ['8.0', '8.1', '8.2', '8.3'] steps: ## checkout the repoistory - name: Checkout Repo From 9e48af965b2c55cbf63def5ce5a95244f90344e3 Mon Sep 17 00:00:00 2001 From: Nadar Date: Tue, 31 Oct 2023 07:36:50 +0000 Subject: [PATCH 4/6] remove deprecated methods closes #98 --- UPGRADE.md | 7 +++++++ src/Curl/Curl.php | 33 --------------------------------- 2 files changed, 7 insertions(+), 33 deletions(-) create mode 100644 UPGRADE.md diff --git a/UPGRADE.md b/UPGRADE.md new file mode 100644 index 0000000..7dded15 --- /dev/null +++ b/UPGRADE.md @@ -0,0 +1,7 @@ +This document will help you upgrading from a Version into another. + +# 2.x to 3.0 + ++ Raised minimum PHP version to 8.x ++ Added php `json` extensions are required in composer defintion ++ Removed deprecated methods `_exec()` use `exec()`, `setReferrer()` use `setReferer()` and `verbose()` use `setVerbose()` \ No newline at end of file diff --git a/src/Curl/Curl.php b/src/Curl/Curl.php index f3c801b..5794b9f 100644 --- a/src/Curl/Curl.php +++ b/src/Curl/Curl.php @@ -282,16 +282,6 @@ protected function setHttpAuth($httpauth) $this->setOpt(CURLOPT_HTTPAUTH, $httpauth); } - // public methods - - /** - * @deprecated use `exec()` directly. Will be removed in 3.0 - */ - public function _exec() - { - return $this->exec(); - } - // functions /** @@ -511,18 +501,6 @@ public function setUserAgent($useragent) return $this; } - /** - * @deprecated Call setReferer() instead. Will be removed in 3.0 - * - * @param $referrer - * @return self - */ - public function setReferrer($referrer) - { - $this->setReferer($referrer); - return $this; - } - /** * Set the HTTP referer header. * @@ -617,17 +595,6 @@ public function setVerbose($on = true) return $this; } - /** - * @deprecated Call setVerbose() instead. Will be removed in 3.0 - * - * @param bool $on - * @return self - */ - public function verbose($on = true) - { - return $this->setVerbose($on); - } - /** * Reset all curl options. * From 0b4534dd286edef3c3540b25a5874af70cd53ae5 Mon Sep 17 00:00:00 2001 From: Nadar Date: Tue, 31 Oct 2023 07:37:58 +0000 Subject: [PATCH 5/6] changelog --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c73ab9a..fcca5d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,12 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). -## 2.6.0 +## 3.0.0 + +> Check the [UPGRADE document](UPGRADE.md) to read more about breaking changes. + ++ [#105](https://github.com/php-mod/curl/pull/105) Min PHP version is 8.x, json-extension is required and dropped deprecated methods. + ## 2.5.0 (14. December 2022) From b67d66cdbbf8be9cf01a196d05c8a59dfaf84b1b Mon Sep 17 00:00:00 2001 From: Nadar Date: Tue, 31 Oct 2023 07:46:50 +0000 Subject: [PATCH 6/6] remove deprecated method --- tests/CurlTest.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tests/CurlTest.php b/tests/CurlTest.php index 452a38d..40efdc1 100644 --- a/tests/CurlTest.php +++ b/tests/CurlTest.php @@ -266,15 +266,6 @@ public function testReferrer() )) === 'myreferrer'); } - public function testDeprecatedReferrer() - { - $this->curl->setReferrer('myreferrer'); - $this->assertTrue($this->server('GET', array( - 'test' => 'server', - 'key' => 'HTTP_REFERER', - )) === 'myreferrer'); - } - public function testCookies() { $this->curl->setCookie('mycookie', 'yum');