Skip to content

Commit

Permalink
Revert "Version 3.0"
Browse files Browse the repository at this point in the history
  • Loading branch information
nadar authored Oct 31, 2023
1 parent 54ea806 commit 1195ce8
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 21 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
php: ['8.0', '8.1', '8.2', '8.3']
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
steps:
## checkout the repoistory
- name: Checkout Repo
Expand Down Expand Up @@ -66,18 +66,18 @@ 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'
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'

## unit test with coverage
- name: PHP Unit tests for PHP 8.0
- name: PHP Unit tests for PHP 7.1
run: vendor/bin/phpunit --verbose --coverage-clover=clover.xml --configuration actions.phpunit.xml
if: matrix.php == '8.0'
if: matrix.php == '7.1'

## coverage
- name: Code coverage
run: |
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 == '8.0'
if: matrix.php == '7.1'
continue-on-error: true # if is fork
7 changes: 1 addition & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@

All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).

## 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.6.0

## 2.5.0 (14. December 2022)

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ 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:
Expand Down
7 changes: 0 additions & 7 deletions UPGRADE.md

This file was deleted.

5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@
}
],
"require": {
"php": "^8.0",
"ext-curl": "*",
"ext-json": "*"
"php": "^5.6 | ^7.0 | ^8.0",
"ext-curl": "*"
},
"require-dev": {
"yoast/phpunit-polyfills": "^0.2.0"
Expand Down
33 changes: 33 additions & 0 deletions src/Curl/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,16 @@ 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

/**
Expand Down Expand Up @@ -501,6 +511,18 @@ 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.
*
Expand Down Expand Up @@ -595,6 +617,17 @@ 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.
*
Expand Down
9 changes: 9 additions & 0 deletions tests/CurlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,15 @@ 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');
Expand Down

0 comments on commit 1195ce8

Please sign in to comment.