PHPackages                             php-curl-class/php-curl-class - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. php-curl-class/php-curl-class

ActiveLibrary[Framework](/categories/framework)

php-curl-class/php-curl-class
=============================

PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs.

12.0.4(5mo ago)3.3k9.5M—1.6%813[1 issues](https://github.com/php-curl-class/php-curl-class/issues)20UnlicensePHPPHP &gt;=8.0CI passing

Since Apr 12Pushed 1mo ago156 watchersCompare

[ Source](https://github.com/php-curl-class/php-curl-class)[ Packagist](https://packagist.org/packages/php-curl-class/php-curl-class)[ Docs](https://github.com/php-curl-class/php-curl-class)[ RSS](/packages/php-curl-class-php-curl-class/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (121)Used By (20)

PHP Curl Class: HTTP requests made easy
=======================================

[](#php-curl-class-http-requests-made-easy)

[![](https://camo.githubusercontent.com/cbd2836e8fc6357979b4647e039d3bf23f5dab1b37d2d677e0b4a3ef0d22acef/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f7068702d6375726c2d636c6173732f7068702d6375726c2d636c6173732e7376673f7374796c653d666f722d7468652d626164676526736f72743d73656d766572)](https://github.com/php-curl-class/php-curl-class/releases/)[![](https://camo.githubusercontent.com/7dd3ba42c1aa6944b6560a40287c36f52d111bf3a541f1431be6670bcfba9c03/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f7068702d6375726c2d636c6173732f7068702d6375726c2d636c6173732e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/php-curl-class/php-curl-class/blob/master/LICENSE)[![](https://camo.githubusercontent.com/d2c4c15da695ba4814eae8be92dd8866484a3d63dee43014353fee655fbd51b0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7068702d6375726c2d636c6173732f7068702d6375726c2d636c6173732f63692e796d6c3f7374796c653d666f722d7468652d6261646765266c6162656c3d6275696c64266272616e63683d6d6173746572)](https://github.com/php-curl-class/php-curl-class/actions/workflows/ci.yml)[![](https://camo.githubusercontent.com/dfebcddbc87d4a7dddeb2e8de77c42a5dee045b7c54c11daddbdf9cc5a3178a4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7068702d6375726c2d636c6173732f7068702d6375726c2d636c6173732f72656c656173652e796d6c3f7374796c653d666f722d7468652d6261646765266c6162656c3d72656c65617365266272616e63683d6d6173746572)](https://github.com/php-curl-class/php-curl-class/releases/)[![](https://camo.githubusercontent.com/667c4ebd40cf0a468a7a80b20eb92d8b09c8b40a3e18e1372f1bf664896c543f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7068702d6375726c2d636c6173732f7068702d6375726c2d636c6173732f646570656e6461626f742f646570656e6461626f742d757064617465733f7374796c653d666f722d7468652d6261646765266c6162656c3d446570656e6461626f74266272616e63683d6d6173746572)](https://github.com/php-curl-class/php-curl-class/actions/workflows/dependabot/dependabot-updates)[![](https://camo.githubusercontent.com/be8ca7ca94be59709a2405c26020e5ad19db785d6d076d8119289d451b7326f6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068702d6375726c2d636c6173732f7068702d6375726c2d636c6173732e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/php-curl-class/php-curl-class/releases/)

PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs.

[![PHP Curl Class screencast](www/img/screencast.gif)](www/img/screencast.gif)

---

- [⚙️ Installation](#%EF%B8%8F-installation)
- [📋 Requirements](#-requirements)
- [🚀 Quick Start and Examples](#-quick-start-and-examples)
- [📖 Available Methods](#-available-methods)
- [🔒 Security](#-security)
- [🛠️ Troubleshooting](#%EF%B8%8F-troubleshooting)
- [🧪 Testing](#-testing)
- [🤝 Contributing](#-contributing)

---

### ⚙️ Installation

[](#️-installation)

To install PHP Curl Class, run the following command:

```
composer require php-curl-class/php-curl-class

```

To install the latest commit version:

```
composer require php-curl-class/php-curl-class @dev

```

Installation instructions to use the `composer` command can be found on .

### 📋 Requirements

[](#-requirements)

PHP Curl Class works with PHP versions 8.5, 8.4, 8.3, 8.2, 8.1, and 8.0.

### 🚀 Quick Start and Examples

[](#-quick-start-and-examples)

More examples are available under [/examples](https://github.com/php-curl-class/php-curl-class/tree/master/examples).

```
require __DIR__ . '/vendor/autoload.php';

use Curl\Curl;

$curl = new Curl();
$curl->get('https://www.example.com/');

if ($curl->error) {
    echo 'Error: ' . $curl->errorMessage . "\n";
    $curl->diagnose();
} else {
    echo 'Response:' . "\n";
    var_dump($curl->response);
}
```

```
// https://www.example.com/search?q=keyword
$curl = new Curl();
$curl->get('https://www.example.com/search', [
    'q' => 'keyword',
]);
```

```
$curl = new Curl();
$curl->post('https://www.example.com/login/', [
    'username' => 'myusername',
    'password' => 'mypassword',
]);
```

```
$curl = new Curl();
$curl->setBasicAuthentication('username', 'password');
$curl->setUserAgent('MyUserAgent/0.0.1 (+https://www.example.com/bot.html)');
$curl->setReferrer('https://www.example.com/url?url=https%3A%2F%2Fwww.example.com%2F');
$curl->setHeader('X-Requested-With', 'XMLHttpRequest');
$curl->setCookie('key', 'value');
$curl->get('https://www.example.com/');

if ($curl->error) {
    echo 'Error: ' . $curl->errorMessage . "\n";
} else {
    echo 'Response:' . "\n";
    var_dump($curl->response);
}

var_dump($curl->requestHeaders);
var_dump($curl->responseHeaders);
```

```
$curl = new Curl();
$curl->setFollowLocation();
$curl->get('https://shortn.example.com/bHbVsP');
```

```
$curl = new Curl();
$curl->put('https://api.example.com/user/', [
    'first_name' => 'Zach',
    'last_name' => 'Borboa',
]);
```

```
$curl = new Curl();
$curl->patch('https://api.example.com/profile/', [
    'image' => '@path/to/file.jpg',
]);
```

```
$curl = new Curl();
$curl->patch('https://api.example.com/profile/', [
    'image' => new CURLFile('path/to/file.jpg'),
]);
```

```
$curl = new Curl();
$curl->delete('https://api.example.com/user/', [
    'id' => '1234',
]);
```

```
// Enable all supported encoding types and download a file.
$curl = new Curl();
$curl->setOpt(CURLOPT_ENCODING , '');
$curl->download('https://www.example.com/file.bin', '/tmp/myfile.bin');
```

```
// Case-insensitive access to headers.
$curl = new Curl();
$curl->download('https://www.example.com/image.png', '/tmp/myimage.png');
echo $curl->responseHeaders['Content-Type'] . "\n"; // image/png
echo $curl->responseHeaders['CoNTeNT-TyPE'] . "\n"; // image/png
```

```
// Manual clean up.
$curl->close();
```

```
// Example access to curl object.
curl_set_opt($curl->curl, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1');
```

```
require __DIR__ . '/vendor/autoload.php';

use Curl\MultiCurl;

// Requests in parallel with callback functions.
$multi_curl = new MultiCurl();

$multi_curl->success(function($instance) {
    echo 'call to "' . $instance->url . '" was successful.' . "\n";
    echo 'response:' . "\n";
    var_dump($instance->response);
});
$multi_curl->error(function($instance) {
    echo 'call to "' . $instance->url . '" was unsuccessful.' . "\n";
    echo 'error code: ' . $instance->errorCode . "\n";
    echo 'error message: ' . $instance->errorMessage . "\n";
});
$multi_curl->complete(function($instance) {
    echo 'call completed' . "\n";
});

$multi_curl->addGet('https://www.google.com/search', [
    'q' => 'hello world',
]);
$multi_curl->addGet('https://duckduckgo.com/', [
    'q' => 'hello world',
]);
$multi_curl->addGet('https://www.bing.com/search', [
    'q' => 'hello world',
]);

$multi_curl->start(); // Blocks until all items in the queue have been processed.
```

More examples are available under [/examples](https://github.com/php-curl-class/php-curl-class/tree/master/examples).

### 📖 Available Methods

[](#-available-methods)

```
Curl::__construct($base_url = null, $options = [])
Curl::__destruct()
Curl::__get($name)
Curl::__isset($name)
Curl::afterSend($callback)
Curl::attemptRetry()
Curl::beforeSend($callback)
Curl::buildPostData($data)
Curl::call()
Curl::close()
Curl::complete($callback)
Curl::delete($url, $query_parameters = [], $data = [])
Curl::diagnose($return = false)
Curl::disableTimeout()
Curl::displayCurlOptionValue($option, $value = null)
Curl::download($url, $mixed_filename)
Curl::error($callback)
Curl::exec($ch = null)
Curl::execDone()
Curl::fastDownload($url, $filename, $connections = 4)
Curl::get($url, $data = [])
Curl::getAttempts()
Curl::getBeforeSendCallback()
Curl::getCompleteCallback()
Curl::getCookie($key)
Curl::getCurl()
Curl::getCurlErrorCode()
Curl::getCurlErrorMessage()
Curl::getDownloadCompleteCallback()
Curl::getDownloadFileName()
Curl::getErrorCallback()
Curl::getErrorCode()
Curl::getErrorMessage()
Curl::getFileHandle()
Curl::getHttpErrorMessage()
Curl::getHttpStatusCode()
Curl::getId()
Curl::getInfo($opt = null)
Curl::getJsonDecoder()
Curl::getOpt($option)
Curl::getOptions()
Curl::getRawResponse()
Curl::getRawResponseHeaders()
Curl::getRemainingRetries()
Curl::getRequestHeaders()
Curl::getResponse()
Curl::getResponseCookie($key)
Curl::getResponseCookies()
Curl::getResponseHeaders()
Curl::getRetries()
Curl::getRetryDecider()
Curl::getSuccessCallback()
Curl::getUrl()
Curl::getUserSetOptions()
Curl::getXmlDecoder()
Curl::head($url, $data = [])
Curl::isChildOfMultiCurl()
Curl::isCurlError()
Curl::isError()
Curl::isHttpError()
Curl::options($url, $data = [])
Curl::patch($url, $data = [])
Curl::post($url, $data = '', $follow_303_with_post = false)
Curl::progress($callback)
Curl::put($url, $data = [])
Curl::removeHeader($key)
Curl::reset()
Curl::search($url, $data = [])
Curl::setAutoReferer($auto_referer = true)
Curl::setAutoReferrer($auto_referrer = true)
Curl::setBasicAuthentication($username, $password = '')
Curl::setConnectTimeout($seconds)
Curl::setCookie($key, $value)
Curl::setCookieFile($cookie_file)
Curl::setCookieJar($cookie_jar)
Curl::setCookieString($string)
Curl::setCookies($cookies)
Curl::setDefaultDecoder($mixed = 'json')
Curl::setDefaultHeaderOut()
Curl::setDefaultJsonDecoder()
Curl::setDefaultTimeout()
Curl::setDefaultUserAgent()
Curl::setDefaultXmlDecoder()
Curl::setDelete($url, $query_parameters = [], $data = [])
Curl::setDigestAuthentication($username, $password = '')
Curl::setFile($file)
Curl::setFollowLocation($follow_location = true)
Curl::setForbidReuse($forbid_reuse = true)
Curl::setGet($url, $data = [])
Curl::setHead($url, $data = [])
Curl::setHeader($key, $value)
Curl::setHeaders($headers)
Curl::setInterface($interface)
Curl::setJsonDecoder($mixed)
Curl::setMaxFilesize($bytes)
Curl::setMaximumRedirects($maximum_redirects)
Curl::setOpt($option, $value)
Curl::setOptions($url, $data = [])
Curl::setOpts($options)
Curl::setPatch($url, $data = [])
Curl::setPort($port)
Curl::setPost($url, $data = '', $follow_303_with_post = false)
Curl::setProtocols($protocols)
Curl::setProxy($proxy, $port = null, $username = null, $password = null)
Curl::setProxyAuth($auth)
Curl::setProxyTunnel($tunnel = true)
Curl::setProxyType($type)
Curl::setPut($url, $data = [])
Curl::setRange($range)
Curl::setRedirectProtocols($redirect_protocols)
Curl::setReferer($referer)
Curl::setReferrer($referrer)
Curl::setRetry($mixed)
Curl::setSearch($url, $data = [])
Curl::setStop($callback = null)
Curl::setTimeout($seconds)
Curl::setUrl($url, $mixed_data = '')
Curl::setUserAgent($user_agent)
Curl::setXmlDecoder($mixed)
Curl::stop()
Curl::success($callback)
Curl::unsetHeader($key)
Curl::unsetProxy()
Curl::verbose($on = true, $output = 'STDERR')
MultiCurl::__construct($base_url = null)
MultiCurl::__destruct()
MultiCurl::addCurl(Curl $curl)
MultiCurl::addDelete($url, $query_parameters = [], $data = [])
MultiCurl::addDownload($url, $mixed_filename)
MultiCurl::addGet($url, $data = [])
MultiCurl::addHead($url, $data = [])
MultiCurl::addOptions($url, $data = [])
MultiCurl::addPatch($url, $data = [])
MultiCurl::addPost($url, $data = '', $follow_303_with_post = false)
MultiCurl::addPut($url, $data = [])
MultiCurl::addSearch($url, $data = [])
MultiCurl::afterSend($callback)
MultiCurl::beforeSend($callback)
MultiCurl::close()
MultiCurl::complete($callback)
MultiCurl::disableTimeout()
MultiCurl::error($callback)
MultiCurl::getActiveCurls()
MultiCurl::getOpt($option)
MultiCurl::removeHeader($key)
MultiCurl::setAutoReferer($auto_referer = true)
MultiCurl::setAutoReferrer($auto_referrer = true)
MultiCurl::setBasicAuthentication($username, $password = '')
MultiCurl::setConcurrency($concurrency)
MultiCurl::setConnectTimeout($seconds)
MultiCurl::setCookie($key, $value)
MultiCurl::setCookieFile($cookie_file)
MultiCurl::setCookieJar($cookie_jar)
MultiCurl::setCookieString($string)
MultiCurl::setCookies($cookies)
MultiCurl::setDigestAuthentication($username, $password = '')
MultiCurl::setFile($file)
MultiCurl::setFollowLocation($follow_location = true)
MultiCurl::setForbidReuse($forbid_reuse = true)
MultiCurl::setHeader($key, $value)
MultiCurl::setHeaders($headers)
MultiCurl::setInterface($interface)
MultiCurl::setJsonDecoder($mixed)
MultiCurl::setMaximumRedirects($maximum_redirects)
MultiCurl::setOpt($option, $value)
MultiCurl::setOpts($options)
MultiCurl::setPort($port)
MultiCurl::setProxies($proxies)
MultiCurl::setProxy($proxy, $port = null, $username = null, $password = null)
MultiCurl::setProxyAuth($auth)
MultiCurl::setProxyTunnel($tunnel = true)
MultiCurl::setProxyType($type)
MultiCurl::setRange($range)
MultiCurl::setRateLimit($rate_limit)
MultiCurl::setReferer($referer)
MultiCurl::setReferrer($referrer)
MultiCurl::setRequestTimeAccuracy()
MultiCurl::setRetry($mixed)
MultiCurl::setTimeout($seconds)
MultiCurl::setUrl($url, $mixed_data = '')
MultiCurl::setUserAgent($user_agent)
MultiCurl::setXmlDecoder($mixed)
MultiCurl::start()
MultiCurl::stop()
MultiCurl::success($callback)
MultiCurl::unsetHeader($key)
MultiCurl::unsetProxy()
MultiCurl::verbose($on = true, $output = 'STDERR')
```

### 🔒 Security

[](#-security)

See [SECURITY](https://github.com/php-curl-class/php-curl-class/blob/master/SECURITY.md) for security considerations.

### 🛠️ Troubleshooting

[](#️-troubleshooting)

See [TROUBLESHOOTING](https://github.com/php-curl-class/php-curl-class/blob/master/TROUBLESHOOTING.md) for help troubleshooting.

### 🧪 Testing

[](#-testing)

See [TESTING](https://github.com/php-curl-class/php-curl-class/blob/master/TESTING.md) for testing information.

### 🤝 Contributing

[](#-contributing)

1. Check for open issues or open a new issue to start a discussion around a bug or feature.
2. Fork the repository on GitHub to start making your changes.
3. Write one or more tests for the new feature or that expose the bug.
4. Make code changes to implement the feature or fix the bug.
5. Send a pull request to get your changes merged and published.

###  Health Score

77

—

ExcellentBetter than 100% of packages

Maintenance82

Actively maintained with recent releases

Popularity75

Solid adoption and visibility

Community59

Growing community involvement

Maturity85

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 82% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~37 days

Recently: every ~65 days

Total

114

Last Release

158d ago

Major Versions

8.9.2 → 9.0.02021-03-19

8.10.0 → 9.2.02021-06-23

9.19.2 → 10.0.02024-08-20

10.0.1 → 11.0.02024-08-22

11.1.0 → 12.0.02025-03-25

PHP version history (5 changes)2.1.0PHP &gt;=5.3

9.0.0PHP &gt;=7.0

10.0.0PHP &gt;=7.1

11.0.0PHP &gt;=7.4

12.0.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/30412cb4cd4ee30db59f6f511817eb35f686afa39152482b96ef2297acfa337b?d=identicon)[php-curl-class](/maintainers/php-curl-class)

---

Top Contributors

[![zachborboa](https://avatars.githubusercontent.com/u/1083146?v=4)](https://github.com/zachborboa "zachborboa (1791 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (193 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (105 commits)")[![php-curl-class-helper](https://avatars.githubusercontent.com/u/156273776?v=4)](https://github.com/php-curl-class-helper "php-curl-class-helper (24 commits)")[![zborboa-g](https://avatars.githubusercontent.com/u/6154360?v=4)](https://github.com/zborboa-g "zborboa-g (16 commits)")[![zuoRambo](https://avatars.githubusercontent.com/u/4715122?v=4)](https://github.com/zuoRambo "zuoRambo (3 commits)")[![thebeline](https://avatars.githubusercontent.com/u/130580?v=4)](https://github.com/thebeline "thebeline (3 commits)")[![Gormartsen](https://avatars.githubusercontent.com/u/5018896?v=4)](https://github.com/Gormartsen "Gormartsen (3 commits)")[![isecret](https://avatars.githubusercontent.com/u/15724152?v=4)](https://github.com/isecret "isecret (3 commits)")[![case](https://avatars.githubusercontent.com/u/20105?v=4)](https://github.com/case "case (3 commits)")[![maxvodo](https://avatars.githubusercontent.com/u/5998258?v=4)](https://github.com/maxvodo "maxvodo (3 commits)")[![mydansun](https://avatars.githubusercontent.com/u/8871143?v=4)](https://github.com/mydansun "mydansun (3 commits)")[![RobinvanderVliet](https://avatars.githubusercontent.com/u/692029?v=4)](https://github.com/RobinvanderVliet "RobinvanderVliet (3 commits)")[![Philipp91](https://avatars.githubusercontent.com/u/2501211?v=4)](https://github.com/Philipp91 "Philipp91 (2 commits)")[![failpunk](https://avatars.githubusercontent.com/u/1109167?v=4)](https://github.com/failpunk "failpunk (2 commits)")[![giansalex](https://avatars.githubusercontent.com/u/14926587?v=4)](https://github.com/giansalex "giansalex (2 commits)")[![k00ni](https://avatars.githubusercontent.com/u/381727?v=4)](https://github.com/k00ni "k00ni (2 commits)")[![Oxicode](https://avatars.githubusercontent.com/u/1320709?v=4)](https://github.com/Oxicode "Oxicode (2 commits)")[![petewatts](https://avatars.githubusercontent.com/u/5468882?v=4)](https://github.com/petewatts "petewatts (2 commits)")[![3kbest](https://avatars.githubusercontent.com/u/25566931?v=4)](https://github.com/3kbest "3kbest (2 commits)")

---

Tags

apiapi-clientclassclientcurlframeworkhttphttp-clienthttp-proxyjsonphpphp-curlphp-curl-libraryproxyrequestsrestfulweb-scraperweb-scrapingweb-servicexmlhttpphpjsonapiclientframeworkproxyxmlcurlhttp clientweb serviceclassapi clientrestfulrequestsphp-curlweb-scraping http-proxyphp-curl-libraryweb-scraper

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/php-curl-class-php-curl-class/health.svg)

```
[![Health](https://phpackages.com/badges/php-curl-class-php-curl-class/health.svg)](https://phpackages.com/packages/php-curl-class-php-curl-class)
```

###  Alternatives

[ismaeltoe/osms

PHP library wrapper of the Orange SMS API.

4540.0k](/packages/ismaeltoe-osms)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
