PHPackages                             bjz/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. bjz/curl

ActiveLibrary[HTTP &amp; Networking](/categories/http)

bjz/curl
========

cURL class for PHP .change function setOpt to return $this for chan operation

1.9.1(7y ago)09MITPHPPHP &gt;=5.3.0

Since Nov 3Pushed 7y agoCompare

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

READMEChangelogDependencies (2)Versions (23)Used By (0)

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

[](#php-curl-class)

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

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
```

or add the package manually to your composer.json file in the require section:

```
"curl/curl": "^1.5"
```

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

[](#usage-examples)

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

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

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

```
$curl = new Curl\Curl();
$curl->setBasicAuthentication('username', 'password');
$curl->setUserAgent('');
$curl->setReferrer('');
$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);
```

```
$curl = new Curl\Curl();
$curl->setOpt(CURLOPT_RETURNTRANSFER, TRUE);
$curl->setOpt(CURLOPT_SSL_VERIFYPEER, FALSE);
$curl->get('https://encrypted.example.com/');
```

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

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

```
$curl = new Curl\Curl();
$curl->delete('http://api.example.com/user/', array(
    'id' => '1234',
));
```

```
$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');
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

In order to test the library:

1. Create a fork
2. Clone the fork to your machine
3. Install the depencies `composer install`
4. Run the unit tests `./vendor/bin/phpunit tests`

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 59.6% 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 ~83 days

Recently: every ~75 days

Total

21

Last Release

2914d ago

Major Versions

1.2.0 → 2.0.0-alpha12015-03-08

1.2.1 → 2.x-dev2015-08-09

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

2.0.0-alpha1PHP &gt;=5.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/1897c0e52b39dcde90b05e46d375fa9cfdc2e467e5308e4ae80ee9beb416cb87?d=identicon)[baijunzhen](/maintainers/baijunzhen)

---

Top Contributors

[![amouhzi](https://avatars.githubusercontent.com/u/4458806?v=4)](https://github.com/amouhzi "amouhzi (53 commits)")[![zurborg](https://avatars.githubusercontent.com/u/1327863?v=4)](https://github.com/zurborg "zurborg (6 commits)")[![nadar](https://avatars.githubusercontent.com/u/3417221?v=4)](https://github.com/nadar "nadar (5 commits)")[![MikeLund](https://avatars.githubusercontent.com/u/17044744?v=4)](https://github.com/MikeLund "MikeLund (3 commits)")[![baijunzhen](https://avatars.githubusercontent.com/u/20927708?v=4)](https://github.com/baijunzhen "baijunzhen (2 commits)")[![icemanpro](https://avatars.githubusercontent.com/u/1924688?v=4)](https://github.com/icemanpro "icemanpro (2 commits)")[![JanPetterMG](https://avatars.githubusercontent.com/u/11933090?v=4)](https://github.com/JanPetterMG "JanPetterMG (2 commits)")[![MartijnBraam](https://avatars.githubusercontent.com/u/6928199?v=4)](https://github.com/MartijnBraam "MartijnBraam (2 commits)")[![mrteye](https://avatars.githubusercontent.com/u/1945243?v=4)](https://github.com/mrteye "mrteye (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)")[![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)")[![giantguido](https://avatars.githubusercontent.com/u/3613881?v=4)](https://github.com/giantguido "giantguido (1 commits)")[![charlycoste](https://avatars.githubusercontent.com/u/352634?v=4)](https://github.com/charlycoste "charlycoste (1 commits)")[![J5lx](https://avatars.githubusercontent.com/u/2063777?v=4)](https://github.com/J5lx "J5lx (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)")

---

Tags

curldot

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/bjz-curl/health.svg)](https://phpackages.com/packages/bjz-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)
