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

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

kenvix/curl
===========

A very lite and high compatibility but powerful curl class(especially you're processing http headers and cookies). No dependence.

1.0(7y ago)413MITPHP

Since Sep 2Pushed 5y ago1 watchersCompare

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

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Kenvix/curl
===========

[](#kenvixcurl)

A very lite and high compatibility but powerful curl class(especially you're processing http headers and cookies). No dependence.

Usage
=====

[](#usage)

Basical HTTP request
--------------------

[](#basical-http-request)

### Get

[](#get)

```
$curl = new \Kenvix\curl\curl("https://bing.com/");
$curl->get(); //string response
```

Or:

```
\Kenvix\curl\curl::xget("https://bing.com/");
```

You **can't**:

```
echo new \Kenvix\curl\curl("https://bing.com/"); //Will always print a description
```

### POST

[](#post)

```
$curl = new \Kenvix\curl\curl("https://bing.com/");
$curl->post([  //something to post
    'a' => 'foo',
    'b' => 'excited'
]); //string response
```

### HEAD

[](#head)

```
$curl = new \Kenvix\curl\curl("https://www.bing.com/");
$curl->head(); //array response
```

Response:

```
array (size=9)
  'Cache-Control' => string 'private, max-age=0' (length=18)
  'Transfer-Encoding' => string 'chunked' (length=7)
  'Content-Type' => string 'text/html; charset=utf-8' (length=24)
  'Vary' => string 'Accept-Encoding' (length=15)
...

```

### Get Cookies

[](#get-cookies)

```
$curl = new \Kenvix\curl\curl("https://www.bing.com/");
$curl->head();
$curl->getCookies(); //array
```

Response:

```
Array
(
    [SRCHD] => Array
        (
            [key] => SRCHD
            [value] => AF=NOFORM
            [domain] => .bing.com
            [expires] => Sat, 22-Aug-2020 10:56:24 GMT
            [path] => /
        )

    [_EDGE_V] => Array
        (
            [key] => _EDGE_V
            [value] => 1
            [path] => /
            [httponly] => 1
            [expires] => Mon, 16-Sep-2019 10:56:25 GMT
            [domain] => bing.com
        )
...

```

### Customize request headers

[](#customize-request-headers)

```
$curl = new \Kenvix\curl\curl("https://www.bing.com/",array('User-Agent: chrome', 'Referer: https://kenvix.com'));
```

or

```
$curl->setHeaders(array('User-Agent: chrome', 'Referer: https://kenvix.com'));
```

### Other

[](#other)

```
$curl->put($data);
$curl->delete($data);
```

### Do not follow redirect

[](#do-not-follow-redirect)

**NOTICE:** CURLOPT\_FOLLOWLOCATION HAS ALREADY BEEN SET TO false!!!
get() post() head() delete() put() provide a parameter to allow you to do this.

```
$curl->get(false);
$curl->post([...], false);
```

Useful Methods
--------------

[](#useful-methods)

### addCookie($ck)

[](#addcookieck)

Add a cookie:

```
$curl->addCookie('yes=sir');
```

Add cookies:

```
$curl->addCookie([
    'a' => 'foo',
    'b' => 'excited'
]);
```

### getHTTPCode()

[](#gethttpcode)

returns http code

### getRedirectNum()

[](#getredirectnum)

returns

Common Methods
--------------

[](#common-methods)

### execRaw()

[](#execraw)

returns raw result

### readCookies(array $setcookie)

[](#readcookiesarray-setcookie)

`STATIC`
parse cookies into array

### parseCookieKeyValue($str)

[](#parsecookiekeyvaluestr)

`STATIC`

### getConnection()

[](#getconnection)

Returns curl connection

### setRequestMethod($method)

[](#setrequestmethodmethod)

A custom request method to use instead of "GET" or "HEAD" when doing a HTTP request.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

2812d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/443d5eb41901b418b20c6fa126a78b486eaa2561d003967d7dda5728f67dc930?d=identicon)[Kenvix](/maintainers/Kenvix)

---

Top Contributors

[![kenvix](https://avatars.githubusercontent.com/u/4546175?v=4)](https://github.com/kenvix "kenvix (5 commits)")

---

Tags

curl

### Embed Badge

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

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