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

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

lexeo/curl
==========

Simple PHP5.3+ cURL wrapper

01.3kPHP

Since Dec 20Pushed 10y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

lexeo/Curl
==========

[](#lexeocurl)

Simple cURL wrapper to make HTTP requests easily

\##Requirements

Developed and tested with php 5.3 (php-curl v7.22)

\##Usage

\###Basic

```
[php]
require_once '../src/Request.php';

$request = new Curl\Request();
$request->setUrl('http://google.com');
// or
$request = Curl\Request::newRequest('http://google.com');

// making POST request
$request = Curl\Request::newRequest('http://example.com', 'POST', array(
    'param1' => 1,
    'param2' => 2,
));

// add attachments
$request->attachFiles(array(
    'file' => 'filename.txt',
    'file2' => array('filename1.txt', 'filename2.txt'),
));

$response = $request->getResponse();
// or
$response = $request->send();

echo $response->getContent();
// or
echo $response;

```

\###Advanced

```
[php]
require_once '../src/Request.php';

$request = new Curl\Request('http://google.com');

$request->setTimeout(30)
    ->setConnectionTimeout(5)
    // allow auto redirect but limit 5 times
    ->setAllowRedirect(true, 5)
    ->setRefererUrl('http://some.url');

$request->setHeaders(array(
    // set request headers
    'Accept: text/html',
    'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:26.0) Gecko/20100101 Firefox/26.0'
))->addHeaders(array(
    // append another headers
    'Cache-Control: max-age=0'
));

$request->setOptions(array(
    // set curl options array
    CURLOPT_VERBOSE => false,
    CURLOPT_FAILONERROR => true,
))->addOptions(array(
    // append another options to existing
    CURLINFO_HEADER_OUT => true,
));

$request->on('beforeSend', function(/* null */ $request, Curl\Request $request) {
    // before send the request
})->on('success', function(Curl\Response $response, Curl\Request $request) {
    // if response has no error
    // $response->hasError() retuned false
})->on('error', function(Curl\Response $response, Curl\Request $request) {
    // if response has an error
    // $response->hasError() retuned true
})->on('compete', function(Curl\Response $response, Curl\Request $request) {
    // always on complete request
});

$response = $request->send();

// retrieve request info
$info = $response->getInfo();
var_dump($response->getInfo(true)->http_code, $info['content_type']);

/**
 * Custom Response class
 */
class CustomResponse extends Curl\Response
{
    /**
     * (non-PHPdoc)
     * @see Curl.Response::hasError()
     */
    public function hasError()
    {
        return parent::hasError() && 200 != $this->getInfo(true)->http_code;
    }
}

// use custom response class
// it must implement the Curl\IResponse interface
$request->setResponseClass('CustomResponse');
var_dump($request->send()->hasError());

```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/4597f8ce7150fb5c395d7c911f2e4103713899926dcfd22763340829aeb28ed8?d=identicon)[lexeo](/maintainers/lexeo)

---

Top Contributors

[![lexeo](https://avatars.githubusercontent.com/u/1893804?v=4)](https://github.com/lexeo "lexeo (15 commits)")

### Embed Badge

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

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

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78026.4M414](/packages/react-http)[php-http/curl-client

PSR-18 and HTTPlug Async client with cURL

48347.0M384](/packages/php-http-curl-client)[smi2/phpclickhouse

PHP ClickHouse Client

84310.1M71](/packages/smi2-phpclickhouse)

PHPackages © 2026

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