Skip to content

Add support for psr/http-message v2 #513

Open

Description

@SimonFrings

I recommend adding support for psr/http-message v2, which was released in April and requires PHP 7.2+. To ensure compatibility with psr/http-message v2 across all currently supported versions in http (PHP 5.3+), we will need to implement some additional workarounds for older PHP versions. These workarounds are necessary not only for the current v1 of http, but also for the upcoming v3, which will support PHP 7.1+. We will also need to include additional tests to ensure our compatibility with psr/http-message v2.

Additionally we need to remove the dependency for ringcentral/psr7 as discussed in #485, which currently has a dependency on psr/http-message v1. This project has not received updates since 2020, and it is unlikely to receive support for psr/http-message v2 anytime soon. To ensure compatibility with psr/http-message v2, we must first remove ringcentral/psr7.

I'll update this ticket as we make progress 👍

If you need this feature urgently, you can always reach out to us or help us prioritizing by becoming a sponsor and supporting the ReactPHP ecosystem ❤️

Activity

  1. WyriHaximus commented on May 22, 2025

    @WyriHaximus
    Member

    Could we at least support v2 for react/http 3.x then?

    That is the plan, due to return type hints it's v1 for v1 and v2 for v3.

  2. holtkamp commented on Jun 17, 2025

    @holtkamp

    @WyriHaximus maybe you are aware of it, but on https://github.com/php-fig/http-message/releases/tag/2.0 the following page is mentioned: https://www.php-fig.org/psr/psr-7/meta/#72-type-additions, which suggests that requiring PHP 7.2 and "psr/http-message": "^1.1 || ^2.0" might be a way to support both and let Composer decide what to install?

  3. WyriHaximus commented on Jun 23, 2025

    @WyriHaximus
    Member

    @holtkamp So here is where it gets funny, before @clue and I had to deal with shit in our personal lives the plan was to release v3 targeting PHP 7.1, and then decide what v4 would be. But very likely v4 will be PHP 8.1 and up, which means that v3 won't get psr/http-message v2. Now enough time has passed that we IMHO should skip v3 and go straight to v4, skip straight to psr/http-message v2, and update all others. But haven't talked to @clue in a while, so we haven't aligned and agreed on this. In order to make this happen, we need clue/reactphp-http-proxy#65 by @kwhat (or something along the lines of it) merged and released, and then #542 by @valzargaming (or something the likes of it) in, do all the other v3 and v4 work and release a new major version. Which does all mean it's not a quick and easy in place update for certain packages relying on it.

  4. marcelfolaron commented on Jun 23, 2025

    @marcelfolaron

    Hm, the problem is of course that the longer you wait the more packages will start having incompatibilities. I'm all for backwards compatibility but do you really need php 7.1? End of life was 8 years ago and end of security support 5 years. A minor release with an update to require 7.4 (which is 2 years past security support) seems appropriate.

  5. WyriHaximus commented on Jun 23, 2025

    @WyriHaximus
    Member

    Exactly, that's my point of going with v4 and skipping v3. Also, we're not just consumers of psr/http-message, we also provide implementations, so updating those classes is a BC break depending on how you look at it. And I really want to get v4 out because v1 currently supports all the way down to PHP 5.3....

  6. alexis1704 commented on Dec 27, 2025

    @alexis1704

    Hello, any update here?
    My application needs pst/http-message v2, no way to use v1.
    Thanks!

  7. mvaessen commented on Aug 14, 2026

    @mvaessen

    I noticed there has been some progress lately. That is great new!

    I was wondering whether you are able to grant any insight about when this is expected to get merged.
    Since #513 was opened in 2023, how likely is it that v3 (or v4) with the psr/http-message v2 patch ships before 2027? Don't want to pin you down or rush, but some info would help me with making decisions.

  8. added this to the v1.12.0 milestone on Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions