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

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

jdriscoll/curl-psr
==================

A utility for using PSR-7 Request and Response objects with Curl

v2.0.0(3mo ago)0301BSD-2-ClausePHPPHP ^8.5

Since May 18Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/jj101k/curl-psr)[ Packagist](https://packagist.org/packages/jdriscoll/curl-psr)[ RSS](/packages/jdriscoll-curl-psr/feed)WikiDiscussions main Synced today

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

Overview
========

[](#overview)

This lets you run Curl requests with PSR-7 objects. This has a few benefits:

1. It keeps you away from Curl syntax, which is complicated when you're doing more than just downloading a file
2. If you're proxying, this requires less code as PSR-7 ServerRequest is compliant with PSR-7 Request - in other words, a modified version of your `$request` would usually work fine.
3. Sending the response back is simpler
4. Streaming responses is significantly more straightwarward

Usage
=====

[](#usage)

```
    $handler = new \CurlPsr\Handler();
    $response = $handler->run(
        $request->withUri(
            $request->getUri()
                ->withPath("/")
                ->withHost("example.org")
                ->withScheme("http")
                ->withPort(80)
        ),
        true,
        10000
    );

```

The primary aim of this is to make JSON API proxies simpler.

Limitations
===========

[](#limitations)

This does not attempt to support every possible Curl feature nor everything that can be expressed in PSR-7 requests/responses. Key functionality that should always work includes:

- HEAD requests with properly retained headers
- GET requests to JSON endpoints which may or may not stream
- JSON-RPC request and response passthrough via POST
- DELETE requests
- OPTIONS requests
- PUT requests for short JSON resources

Advanced Usage
==============

[](#advanced-usage)

If you want to do two or more requests in parallel, you can. To do this, you use:

```
    $handler = new \CurlPsr\Handler();
    $responses = $handler->withTimeout(10000)->runSimple(
        $request1,
        $request2
    );
    foreach($responses as $k => $response) {
        if($response->getBody()->getSize()) {
            echo "" . $response->getUri();
            echo "" . $response->getBody();
        }
    }

```

The return to `runSimple()` is in fact an iterator which will run over the same objects multiple times: once for the headers, once or more for body chunks, and once more when the transfer is known to be complete. The body attached to the response will always be up-to-date with the latest packet, but won't report a size until it's done.

If you want specific keys to make it easier to tell which response is which, you can use `runMap()`:

```
    $handler = new \CurlPsr\Handler();
    $responses = $handler->withTimeout(10000)->runMap([
        "a" => $request1,
        "b" => $request2
    ]);
    foreach($responses as $k => $response) {
        if($response->getBody()->getSize()) {
            echo "" . $response->getUri();
            echo "" . $response->getBody();
        }
    }

```

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance81

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity83

Battle-tested with a long release history

 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

Every ~244 days

Recently: every ~609 days

Total

11

Last Release

100d ago

Major Versions

v0.9.4 → v1.0.02019-05-25

v1.1.3 → v2.0.02026-01-30

PHP version history (2 changes)v0.9.0PHP ^7.1

v2.0.0PHP ^8.5

### Community

Maintainers

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

---

Top Contributors

[![jj101k](https://avatars.githubusercontent.com/u/444556?v=4)](https://github.com/jj101k "jj101k (50 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[friendsofsymfony/rest-bundle

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

2.8k73.3M318](/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)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M292](/packages/pusher-pusher-php-server)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

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

78126.4M414](/packages/react-http)

PHPackages © 2026

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