Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "curl/curl",
"description": "cURL class for PHP",
"name": "migrad/curl",
"description": "Fork from curl/curl: cURL class for PHP",
"keywords": ["dot", "curl"],
"homepage": "https://github.com/php-mod/curl",
"homepage": "https://github.com/migrad/curl",
"type": "library",
"license": "MIT",
"authors": [
Expand All @@ -18,6 +18,10 @@
{
"name": "user52",
"homepage": "https://github.com/user52"
},
{
"name": "migrad"
"homepage": "https://github.com/migrad"
}
],
"require": {
Expand Down
20 changes: 16 additions & 4 deletions src/Curl/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,15 +342,21 @@ public function post($url, $data = array(), $asJson = false)
* @param string $url The url to make the put request
* @param array $data Optional data to pass to the $url
* @param bool $payload Whether the data should be transmitted trough payload or as get parameters of the string
* @param boolean $asJson Whether the data should be passed as json or not.
* @return self
*/
public function put($url, $data = array(), $payload = false)
public function put($url, $data = array(), $payload = false, $asJson = false)
{
if (! empty($data)) {
if ($payload === false) {
$url .= '?'.http_build_query($data);
} else {
$this->preparePayload($data);
if ($asJson) {
$this->prepareJsonPayload($data);
}
else {
$this->preparePayload($data);
}
}
}

Expand All @@ -368,15 +374,21 @@ public function put($url, $data = array(), $payload = false)
* @param string $url The url to make the patch request
* @param array $data Optional data to pass to the $url
* @param bool $payload Whether the data should be transmitted trough payload or as get parameters of the string
* @param boolean $asJson Whether the data should be passed as json or not.
* @return self
*/
public function patch($url, $data = array(), $payload = false)
public function patch($url, $data = array(), $payload = false, $asJson = false)
{
if (! empty($data)) {
if ($payload === false) {
$url .= '?'.http_build_query($data);
} else {
$this->preparePayload($data);
if ($asJson) {
$this->prepareJsonPayload($data);
}
else {
$this->preparePayload($data);
}
}
}

Expand Down