PHPackages                             rmccue/requests - 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. rmccue/requests

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

rmccue/requests
===============

A HTTP library written in PHP, for human beings.

v2.0.17(5mo ago)3.6k34.5M—1.9%501[93 issues](https://github.com/WordPress/Requests/issues)[27 PRs](https://github.com/WordPress/Requests/pulls)20ISCPHPPHP &gt;=5.6CI passing

Since Oct 6Pushed 5d ago118 watchersCompare

[ Source](https://github.com/WordPress/Requests)[ Packagist](https://packagist.org/packages/rmccue/requests)[ Docs](https://requests.ryanmccue.info/)[ RSS](/packages/rmccue-requests/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (48)Used By (20)Security (1)

Requests for PHP
================

[](#requests-for-php)

[![CS](https://github.com/WordPress/Requests/actions/workflows/cs.yml/badge.svg)](https://github.com/WordPress/Requests/actions/workflows/cs.yml)[![Lint](https://github.com/WordPress/Requests/actions/workflows/lint.yml/badge.svg)](https://github.com/WordPress/Requests/actions/workflows/lint.yml)[![Test](https://github.com/WordPress/Requests/actions/workflows/test.yml/badge.svg)](https://github.com/WordPress/Requests/actions/workflows/test.yml)[![codecov.io](https://camo.githubusercontent.com/dee6fb0519bfa8d0db6e3ad9b3f8a4ec5b3b30a5814655db9641afcd37d0ffc6/68747470733a2f2f636f6465636f762e696f2f67682f576f726450726573732f52657175657374732f6272616e63682f737461626c652f67726170682f62616467652e7376673f746f6b656e3d416670784b37574d786a266272616e63683d737461626c65)](https://codecov.io/gh/WordPress/Requests?branch=stable)[![Packagist License](https://camo.githubusercontent.com/f506a2a67d60387d2e6c3b0116a9c052229aaec0e39f65651984998c3b0f18c1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f726d636375652f7265717565737473)](https://github.com/WordPress/Requests/blob/stable/LICENSE)

Requests is a HTTP library written in PHP, for human beings. It is roughly based on the API from the excellent [Requests Python library](https://requests.readthedocs.io/en/latest/). Requests is [ISC Licensed](https://github.com/WordPress/Requests/blob/stable/LICENSE) (similar to the new BSD license) and has no dependencies, except for PHP 5.6.20+.

Despite PHP's use as a language for the web, its tools for sending HTTP requests are severely lacking. cURL has an [interesting API](https://www.php.net/curl-setopt), to say the least, and you can't always rely on it being available. Sockets provide only low level access, and require you to build most of the HTTP response parsing yourself.

We all have better things to do. That's why Requests was born.

```
$headers = array('Accept' => 'application/json');
$options = array('auth' => array('user', 'pass'));
$request = WpOrg\Requests\Requests::get('https://api.github.com/gists', $headers, $options);

var_dump($request->status_code);
// int(200)

var_dump($request->headers['content-type']);
// string(31) "application/json; charset=utf-8"

var_dump($request->body);
// string(26891) "[...]"
```

Requests allows you to send **HEAD**, **GET**, **POST**, **PUT**, **DELETE**, and **PATCH** HTTP requests. You can add headers, form data, multipart files, and parameters with basic arrays, and access the response data in the same way. Requests uses cURL and fsockopen, depending on what your system has available, but abstracts all the nasty stuff out of your way, providing a consistent API.

Features
--------

[](#features)

- International Domains and URLs
- Browser-style SSL Verification
- Basic/Digest Authentication
- Automatic Decompression
- Connection Timeouts

Installation
------------

[](#installation)

### Install with Composer

[](#install-with-composer)

If you're using [Composer](https://getcomposer.org/) to manage dependencies, you can add Requests with it.

```
composer require rmccue/requests
```

or

```
{
    "require": {
        "rmccue/requests": "^2.0"
    }
}
```

### Install source from GitHub

[](#install-source-from-github)

To install the source code:

```
$ git clone git://github.com/WordPress/Requests.git
```

Next, include the autoloader in your scripts:

```
require_once '/path/to/Requests/src/Autoload.php';
```

You'll probably also want to register the autoloader:

```
WpOrg\Requests\Autoload::register();
```

### Install source from zip/tarball

[](#install-source-from-ziptarball)

Alternatively, you can fetch a [tarball](https://github.com/WordPress/Requests/tarball/stable) or [zipball](https://github.com/WordPress/Requests/zipball/stable):

```
$ curl -L https://github.com/WordPress/Requests/tarball/stable | tar xzv
(or)
$ wget https://github.com/WordPress/Requests/tarball/stable -O - | tar xzv
```

### Using a Class Loader

[](#using-a-class-loader)

If you're using a class loader (e.g., [Symfony Class Loader](https://github.com/symfony/ClassLoader)) for [PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4.md)-style class loading:

```
$loader = new Psr4ClassLoader();
$loader->addPrefix('WpOrg\\Requests\\', 'path/to/vendor/Requests/src');
$loader->register();
```

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

[](#documentation)

The best place to start is our [prose-based documentation](https://github.com/WordPress/Requests/blob/stable/docs/README.md), which will guide you through using Requests.

After that, take a look at [the documentation for `\WpOrg\Requests\Requests::request()`](https://requests.ryanmccue.info/api-2.x/classes/WpOrg-Requests-Requests.html#method_request), where all the parameters are fully documented.

Requests is [100% documented with PHPDoc](https://requests.ryanmccue.info/api-2.x/). If you find any problems with it, [create a new issue](https://github.com/WordPress/Requests/issues/new)!

Test Coverage
-------------

[](#test-coverage)

Requests strives to have 100% code-coverage of the library with an extensive set of tests. We're not quite there yet, but [we're getting close](https://codecov.io/github/WordPress/Requests/).

Requests and PSR-7/PSR-18
-------------------------

[](#requests-and-psr-7psr-18)

[PSR-7](https://www.php-fig.org/psr/psr-7/) describes common interfaces for representing HTTP messages. [PSR-18](https://www.php-fig.org/psr/psr-18/) describes a common interface for sending HTTP requests and receiving HTTP responses.

Both PSR-7 as well as PSR-18 were created after Requests' conception. At this time, there is no intention to add a native PSR-7/PSR-18 implementation to the Requests library.

However, the amazing [Artur Weigandt](https://github.com/Art4) has created a [package](https://packagist.org/packages/art4/requests-psr18-adapter), which allows you to use Requests as a PSR-7 compatible PSR-18 HTTP Client. If you are interested in a PSR-7/PSR-18 compatible version of Requests, we highly recommend you check out [this package](https://packagist.org/packages/art4/requests-psr18-adapter).

Contribute
----------

[](#contribute)

Contributions to this library are very welcome. Please read the [Contributing guidelines](https://github.com/WordPress/Requests/blob/develop/.github/CONTRIBUTING.md) to get started.

###  Health Score

76

—

ExcellentBetter than 100% of packages

Maintenance87

Actively maintained with recent releases

Popularity79

Solid adoption and visibility

Community59

Growing community involvement

Maturity71

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~102 days

Total

23

Last Release

157d ago

Major Versions

v1.8.1 → v2.0.02021-11-24

PHP version history (2 changes)v1.6.0PHP &gt;=5.2

v2.0.0PHP &gt;=5.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/6dde7f578e5530884238e7173f768ae3a890b6d66eb99262a82f2c494a1b67d4?d=identicon)[schlessera](/maintainers/schlessera)

![](https://avatars.githubusercontent.com/u/21655?v=4)[Ryan McCue](/maintainers/rmccue)[@rmccue](https://github.com/rmccue)

![](https://www.gravatar.com/avatar/c276f443673da81d365a16828d46818ea4e3136f7ce05491abcc70f43c82fa4c?d=identicon)[jrfnl](/maintainers/jrfnl)

---

Top Contributors

[![jrfnl](https://avatars.githubusercontent.com/u/663378?v=4)](https://github.com/jrfnl "jrfnl (730 commits)")[![rmccue](https://avatars.githubusercontent.com/u/21655?v=4)](https://github.com/rmccue "rmccue (466 commits)")[![schlessera](https://avatars.githubusercontent.com/u/83631?v=4)](https://github.com/schlessera "schlessera (384 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (41 commits)")[![ozh](https://avatars.githubusercontent.com/u/223647?v=4)](https://github.com/ozh "ozh (35 commits)")[![ntwb](https://avatars.githubusercontent.com/u/1016458?v=4)](https://github.com/ntwb "ntwb (14 commits)")[![dd32](https://avatars.githubusercontent.com/u/767313?v=4)](https://github.com/dd32 "dd32 (11 commits)")[![datagutten](https://avatars.githubusercontent.com/u/715898?v=4)](https://github.com/datagutten "datagutten (10 commits)")[![GeLoLabs](https://avatars.githubusercontent.com/u/149005863?v=4)](https://github.com/GeLoLabs "GeLoLabs (7 commits)")[![ocean90](https://avatars.githubusercontent.com/u/617637?v=4)](https://github.com/ocean90 "ocean90 (7 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (6 commits)")[![zancarius](https://avatars.githubusercontent.com/u/429849?v=4)](https://github.com/zancarius "zancarius (6 commits)")[![soulseekah](https://avatars.githubusercontent.com/u/685880?v=4)](https://github.com/soulseekah "soulseekah (6 commits)")[![JustinyAhin](https://avatars.githubusercontent.com/u/33403964?v=4)](https://github.com/JustinyAhin "JustinyAhin (4 commits)")[![qibinghua](https://avatars.githubusercontent.com/u/848684?v=4)](https://github.com/qibinghua "qibinghua (4 commits)")[![catharsisjelly](https://avatars.githubusercontent.com/u/510747?v=4)](https://github.com/catharsisjelly "catharsisjelly (4 commits)")[![alpipego](https://avatars.githubusercontent.com/u/2003667?v=4)](https://github.com/alpipego "alpipego (3 commits)")[![ccrims0n](https://avatars.githubusercontent.com/u/4971419?v=4)](https://github.com/ccrims0n "ccrims0n (3 commits)")[![cgdangelo](https://avatars.githubusercontent.com/u/206867?v=4)](https://github.com/cgdangelo "cgdangelo (3 commits)")[![KasperFranz](https://avatars.githubusercontent.com/u/191405?v=4)](https://github.com/KasperFranz "KasperFranz (3 commits)")

---

Tags

curlhttphttp-clientphpphp-curlhttpcurlipv6idnairisocketsfsockopen

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/rmccue-requests/health.svg)

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

###  Alternatives

[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

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

PHP ClickHouse Client

84310.1M71](/packages/smi2-phpclickhouse)[pear/http_request2

Provides an easy way to perform HTTP requests.

764.2M48](/packages/pear-http-request2)[chuyskywalker/rolling-curl

Rolling-Curl: A non-blocking, non-dos multi-curl library for PHP

207446.6k6](/packages/chuyskywalker-rolling-curl)

PHPackages © 2026

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