PHPackages                             grantholle/pear-http-request2 - 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. grantholle/pear-http-request2

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

grantholle/pear-http-request2
=============================

A port of pear/http\_request2: Provides an easy way to perform HTTP requests.

4.0.0(3y ago)16332BSD-3-ClausePHPPHP ^8.1

Since Jan 12Pushed 3y agoCompare

[ Source](https://github.com/grantholle/pear-http-request2)[ Packagist](https://packagist.org/packages/grantholle/pear-http-request2)[ Docs](https://github.com/grantholle/pear-http-request2)[ RSS](/packages/grantholle-pear-http-request2/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (2)Versions (12)Used By (2)

HTTP\_Request2
==============

[](#http_request2)

[![Build Status](https://camo.githubusercontent.com/d951ec56b61fb73bbd48196e90e3af604a1ec04419355d5b12b894d62ccfd696/68747470733a2f2f7472617669732d63692e6f72672f706561722f485454505f52657175657374322e7376673f6272616e63683d7472756e6b)](https://travis-ci.org/pear/HTTP_Request2)

Provides an easy way to perform HTTP requests, uses pluggable adapters

- Socket: pure PHP implementation of HTTP protocol (does *not* use http stream wrapper), based on older [PEAR HTTP\_Request](http://pear.php.net/package/HTTP_Request/) package
- Curl: wrapper around PHP's cURL extension
- Mock: used for testing packages depending on HTTP\_Request2, returns predefined responses without network interaction

Both Socket and Curl adapters support POST requests with data and file uploads, basic and digest authentication, cookies, managing cookies across requests, HTTP and SOCKS5 proxies, gzip and deflate encodings, redirects, monitoring the request progress with Observers...

This package is [PEAR HTTP\_Request2](http://pear.php.net/package/HTTP_Request2/) and has been migrated from [PEAR SVN](https://svn.php.net/repository/pear/packages/HTTP_Request2)

Please report all issues via the [GitHub issues](https://github.com/pear/HTTP_Request2/issues).

Pull requests are welcome.

Basic usage
-----------

[](#basic-usage)

```
require_once 'src/Request2.php';

$request = new HTTP_Request2('http://pear.php.net/', HTTP_Request2::METHOD_GET);
try {
    $response = $request->send();
    if (200 == $response->getStatus()) {
        echo $response->getBody();
    } else {
        echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
             $response->getReasonPhrase();
    }
} catch (HTTP_Request2_Exception $e) {
    echo 'Error: ' . $e->getMessage();
}
```

Documentation
-------------

[](#documentation)

...is available on PEAR website

- Numerous [configuration options](http://pear.php.net/manual/en/package.http.http-request2.config.php)
- How to populate [the request object](http://pear.php.net/manual/en/package.http.http-request2.request.php)
- Description of [available adapters](http://pear.php.net/manual/en/package.http.http-request2.adapters.php)
- Processing of [HTTP response](http://pear.php.net/manual/en/package.http.http-request2.response.php)
- Monitoring the progress of request with [observers](http://pear.php.net/manual/en/package.http.http-request2.observers.php)
- Possible [exceptions](http://pear.php.net/manual/en/package.http.http-request2.exceptions.php)

[Generated API documentation](http://pear.php.net/package/HTTP_Request2/docs/latest/) for the current release is also there.

Testing, Packaging and Installing (Pear)
----------------------------------------

[](#testing-packaging-and-installing-pear)

To test, run either

```
$ phpunit tests/

```

or

```
$ pear run-tests -r

```

You may need to set up the NetworkConfig.php file if you want to perform tests that interact with a web server. Its template is NetworkConfig.php.dist file, consult it for the details.

To build, simply

```
$ pear package

```

To install from scratch

```
$ pear install package.xml

```

To upgrade

```
$ pear upgrade -f package.xml

```

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 90% 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 ~474 days

Recently: every ~233 days

Total

8

Last Release

1225d ago

Major Versions

v2.4.1 → 3.0.02020-08-15

3.0.1 → 4.0.02023-02-15

PHP version history (5 changes)v2.2.0PHP &gt;=5.2.0

v2.4.0PHP &gt;=5.6.0

3.0.0PHP ^7.2

3.0.1PHP ^7.2|^8.0

4.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/57ed974235b4a23e6aaf9d9039bff2b0d1268edc0e44ebab6e60e4bf1e6eb144?d=identicon)[grantholle](/maintainers/grantholle)

---

Top Contributors

[![sad-spirit](https://avatars.githubusercontent.com/u/4820288?v=4)](https://github.com/sad-spirit "sad-spirit (197 commits)")[![CloCkWeRX](https://avatars.githubusercontent.com/u/365751?v=4)](https://github.com/CloCkWeRX "CloCkWeRX (9 commits)")[![gauthierm](https://avatars.githubusercontent.com/u/120511?v=4)](https://github.com/gauthierm "gauthierm (3 commits)")[![grantholle](https://avatars.githubusercontent.com/u/1189456?v=4)](https://github.com/grantholle "grantholle (3 commits)")[![deliank](https://avatars.githubusercontent.com/u/5559223?v=4)](https://github.com/deliank "deliank (2 commits)")[![kenguest](https://avatars.githubusercontent.com/u/234118?v=4)](https://github.com/kenguest "kenguest (1 commits)")[![ktomk](https://avatars.githubusercontent.com/u/352517?v=4)](https://github.com/ktomk "ktomk (1 commits)")[![mrook](https://avatars.githubusercontent.com/u/477719?v=4)](https://github.com/mrook "mrook (1 commits)")[![phansys](https://avatars.githubusercontent.com/u/1231441?v=4)](https://github.com/phansys "phansys (1 commits)")[![howard](https://avatars.githubusercontent.com/u/26047?v=4)](https://github.com/howard "howard (1 commits)")

---

Tags

httphttprequestcurlPEAR

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/grantholle-pear-http-request2/health.svg)

```
[![Health](https://phpackages.com/badges/grantholle-pear-http-request2/health.svg)](https://phpackages.com/packages/grantholle-pear-http-request2)
```

###  Alternatives

[pear/http_request2

Provides an easy way to perform HTTP requests.

764.3M53](/packages/pear-http-request2)[aplus/http-client

Aplus Framework HTTP Client Library

2171.6M1](/packages/aplus-http-client)[pdeans/http

PSR-7 cURL HTTP client with support for PSR-17 HTTP factories.

1466.3k3](/packages/pdeans-http)

PHPackages © 2026

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