PHPackages                             php-mod/curl - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. php-mod/curl

Abandoned → [curl/curl](/?search=curl%2Fcurl)Library[HTTP &amp; Networking](/categories/http)

php-mod/curl
============

cURL class for PHP

2.5.0(3y ago)3272.2k↓66.7%119[2 issues](https://github.com/php-mod/curl/issues)[1 PRs](https://github.com/php-mod/curl/pulls)1MITPHPPHP ^5.6 | ^7.0 | ^8.0CI passing

Since Nov 3Pushed 6mo ago12 watchersCompare

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

READMEChangelog (10)Dependencies (1)Versions (34)Used By (1)Security (1)

PHP Curl Class
==============

[](#php-curl-class)

This library provides an object-oriented and dependency free wrapper of the PHP cURL extension.

[![Maintainability](https://camo.githubusercontent.com/9a0f4e313286f2c8981dbc394475ed4c860b236516e09d7eac1cf8e1afc53a37/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f36633334626233316633656236646633366337642f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/php-mod/curl/maintainability)[![Test Coverage](https://camo.githubusercontent.com/523713c4154e36469a4245f91df3028c013ebbc3beff55ea55e76ebadea5d0bf/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f36633334626233316633656236646633366337642f746573745f636f766572616765)](https://codeclimate.com/github/php-mod/curl/test_coverage)[![Total Downloads](https://camo.githubusercontent.com/934bcd0ca16b72e2f6a7dbc22fa5dcf939167d0b5250b22996278e4eeaf8a9c2/68747470733a2f2f706f7365722e707567782e6f72672f6375726c2f6375726c2f646f776e6c6f616473)](//packagist.org/packages/curl/curl)[![Tests](https://github.com/php-mod/curl/actions/workflows/tests.yml/badge.svg)](https://github.com/php-mod/curl/actions/workflows/tests.yml)

If you have questions or problems with installation or usage [create an Issue](https://github.com/php-mod/curl/issues).

Installation
------------

[](#installation)

In order to install this library via composer run the following command in the console:

```
composer require curl/curl
```

Usage examples
--------------

[](#usage-examples)

A few example for using CURL with get:

```
$curl = (new Curl\Curl())->get('http://www.example.com/');
if ($curl->isSuccess()) {
    // do something with response
    var_dump($curl->response);
}
// ensure to close the curl connection
$curl->close();
```

Or with params, values will be encoded with `PHP_QUERY_RFC1738`:

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

An example using post

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

An exampling using basic authentication, remove default user agent and working with error handling

```
$curl = new Curl\Curl();
$curl->setBasicAuthentication('username', 'password');
$curl->setUserAgent('');
$curl->setHeader('X-Requested-With', 'XMLHttpRequest');
$curl->setCookie('key', 'value');
$curl->get('http://www.example.com/');

if ($curl->error) {
    echo $curl->error_code;
} else {
    echo $curl->response;
}

var_dump($curl->request_headers);
var_dump($curl->response_headers);
```

Example access to curl object:

```
curl_set_opt($curl->curl, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1');
curl_close($curl->curl);
```

Example of downloading a file or any other content

```
$curl = new Curl\Curl();
// open the file where the request response should be written
$file_handle = fopen($target_file, 'w+');
// pass it to the curl resource
$curl->setOpt(CURLOPT_FILE, $file_handle);
// do any type of request
$curl->get('https://github.com');
// disable writing to file
$curl->setOpt(CURLOPT_FILE, null);
// close the file for writing
fclose($file_handle);
```

Testing
-------

[](#testing)

In order to test the library:

1. Create a fork
2. Clone the fork to your machine
3. Install the depencies `composer install`
4. Build and start the docker image (in `tests/server`) `docker build . -t curlserver` start `docker run -p 1234:80 curlserver`
5. Run the unit tests `./vendor/bin/phpunit tests`

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance46

Moderate activity, may be stable

Popularity38

Limited adoption so far

Community33

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~132 days

Recently: every ~350 days

Total

32

Last Release

458d ago

Major Versions

1.2.0 → 2.0.0-alpha12015-03-08

1.9.3 → 2.0.02018-11-15

PHP version history (4 changes)1.0PHP &gt;=5.3.0

2.0.0-alpha1PHP &gt;=5.4.0

2.0.0PHP ^5.6 | ^7.0

2.3.1PHP ^5.6 | ^7.0 | ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/8da2a4376a9b330628e63e6d5b11ab407c17549b955b65adc19ca49b914e5fae?d=identicon)[amouhzi](/maintainers/amouhzi)

---

Top Contributors

[![nadar](https://avatars.githubusercontent.com/u/3417221?v=4)](https://github.com/nadar "nadar (87 commits)")[![amouhzi](https://avatars.githubusercontent.com/u/4458806?v=4)](https://github.com/amouhzi "amouhzi (80 commits)")[![zurborg](https://avatars.githubusercontent.com/u/1327863?v=4)](https://github.com/zurborg "zurborg (6 commits)")[![MikeLund](https://avatars.githubusercontent.com/u/17044744?v=4)](https://github.com/MikeLund "MikeLund (3 commits)")[![mrteye](https://avatars.githubusercontent.com/u/1945243?v=4)](https://github.com/mrteye "mrteye (2 commits)")[![KarelWintersky](https://avatars.githubusercontent.com/u/2164874?v=4)](https://github.com/KarelWintersky "KarelWintersky (2 commits)")[![MartijnBraam](https://avatars.githubusercontent.com/u/6928199?v=4)](https://github.com/MartijnBraam "MartijnBraam (2 commits)")[![stevepatter](https://avatars.githubusercontent.com/u/1690712?v=4)](https://github.com/stevepatter "stevepatter (2 commits)")[![user52](https://avatars.githubusercontent.com/u/3287452?v=4)](https://github.com/user52 "user52 (2 commits)")[![JanPetterMG](https://avatars.githubusercontent.com/u/11933090?v=4)](https://github.com/JanPetterMG "JanPetterMG (2 commits)")[![icemanpro](https://avatars.githubusercontent.com/u/1924688?v=4)](https://github.com/icemanpro "icemanpro (2 commits)")[![mean-cj](https://avatars.githubusercontent.com/u/1191385?v=4)](https://github.com/mean-cj "mean-cj (1 commits)")[![charlycoste](https://avatars.githubusercontent.com/u/352634?v=4)](https://github.com/charlycoste "charlycoste (1 commits)")[![paragonie-scott](https://avatars.githubusercontent.com/u/11591518?v=4)](https://github.com/paragonie-scott "paragonie-scott (1 commits)")[![zachborboa](https://avatars.githubusercontent.com/u/1083146?v=4)](https://github.com/zachborboa "zachborboa (1 commits)")[![daniel-zahariev](https://avatars.githubusercontent.com/u/263063?v=4)](https://github.com/daniel-zahariev "daniel-zahariev (1 commits)")[![andreustimm](https://avatars.githubusercontent.com/u/811102?v=4)](https://github.com/andreustimm "andreustimm (1 commits)")[![enrique-ibarra](https://avatars.githubusercontent.com/u/2584986?v=4)](https://github.com/enrique-ibarra "enrique-ibarra (1 commits)")[![evilangelmd](https://avatars.githubusercontent.com/u/6436504?v=4)](https://github.com/evilangelmd "evilangelmd (1 commits)")[![felixkraneveld](https://avatars.githubusercontent.com/u/73889875?v=4)](https://github.com/felixkraneveld "felixkraneveld (1 commits)")

---

Tags

curlhacktoberfestphpcurldot

### Embed Badge

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

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

###  Alternatives

[rmccue/requests

A HTTP library written in PHP, for human beings.

3.6k34.5M258](/packages/rmccue-requests)[kriswallsmith/buzz

Lightweight HTTP client

2.0k31.3M443](/packages/kriswallsmith-buzz)[curl/curl

cURL class for PHP

32814.9M195](/packages/curl-curl)[nategood/httpful

A Readable, Chainable, REST friendly, PHP HTTP Client

1.8k17.2M267](/packages/nategood-httpful)[mashape/unirest-php

Unirest PHP

1.3k9.7M161](/packages/mashape-unirest-php)[php-http/curl-client

PSR-18 and HTTPlug Async client with cURL

48247.0M384](/packages/php-http-curl-client)

PHPackages © 2026

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