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

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

rjr/curl
========

RuanJiaran-CURL class for PHP

v0.2(7y ago)016MITPHPPHP &gt;=5.3.0

Since Oct 30Pushed 7y agoCompare

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

READMEChangelog (1)Dependencies (2)Versions (3)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 rjr/curl
```

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

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

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

[](#usage-examples)

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

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

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

```
$curl = new Rjr\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 Rjr\Curl();
$curl->setOpt(CURLOPT_RETURNTRANSFER, TRUE);
$curl->setOpt(CURLOPT_SSL_VERIFYPEER, FALSE);
$curl->get('https://encrypted.example.com/');
```

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

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

```
$curl = new Rjr\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 Rjr\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

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

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

Total

2

Last Release

2752d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/866cdf58e8b0c8dda16530402f785514d96903d26610f50673186902ba37abb3?d=identicon)[RuanJiaran](/maintainers/RuanJiaran)

---

Tags

curlrjr-curl

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

PHP ClickHouse Client

83510.1M71](/packages/smi2-phpclickhouse)

PHPackages © 2026

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