oscarotero / psr7-middlewares

[DEPRECATED] Collection of PSR-7 middlewares
MIT License
668 stars 56 forks source link

apply http-interop/http-middleware compatibiity #88

Closed basz closed 6 years ago

basz commented 6 years ago

To decouple from a specific version of http-interop/http-middleware which is likely to BC until released you could use https://github.com/webimpress/http-middleware-compatibility

I have implemented into several packages and it works great. We already use it in prooph and PR's for zendframework are coming.

oscarotero commented 6 years ago

All these middlewares are already ported to psr-15 here: https://github.com/middlewares/psr15-middlewares So it's not needed to use this compatibility library.

basz commented 6 years ago

If I'm not mistaking, unless an application itself (or one of its other dependencies) depends on an older version of psr15...

oscarotero commented 6 years ago

Most middlewares have been ported to psr-15 when it was v0.2 and updated with the new versions. For example, in the changelog of https middleware: https://github.com/middlewares/https/blob/master/CHANGELOG.md you can see it was compatible with many versions:

So, if you want to use a specific version of psr-15, a good idea is not specify a version of these middlewares. For example, to use v0.3:

{
    "require": {
        "http-interop/http-middleware": "^0.3",
        "middlewares/https": "*",
        "middlewares/trailing-slash": "*"
    }
}

So, composer should be able to choose the correct version of each middleware.

basz commented 6 years ago

That would work. But you would need to release patches for each 0. version if a bug is found. The compat layer could be implemented in each middlewares/

oscarotero commented 6 years ago

Yes, that's true. My point is this people could use this compat layer to use old middlewares within the newest standard. Anyway, this requires to change +40 packages to use this layer and, honesty, I don't have the time (nor the interest) of doing that. This is a short-term solution and I prefer to wait a bit more for the final release of PSR-15 (that I hope it will be soon). I could use this layer if it were available at the begining, before port all these middlewares to individual and psr-15 compatible packages.

basz commented 6 years ago

I totally understand. It think is’n that relevnt now you have split the repo. More useful for frameworkish libraries. Thanks