What is the significance of PHP's PSR-7?

isn"t it web server (nginx,Apache) to handle request headers and request lines?

Why does psr-7 define several interfaces that handle request headers and request lines?

in which scenarios will php receive the original http message directly for processing? And even if it is handled directly, it is usually handled with hyperglobal variables such as $_ SERVER.

Mar.22,2021

of course it makes sense.
you don't think you need it, and most of the time the framework does these things for you.
Let me give you a few examples

  • how to determine whether it is an ajax request or whether http header information is required
  • how can I tell if the request is post, get, or put?
  • how to set cookie

it's true that a lot of things can be achieved without these standards, but why do we say interface-oriented programming is that we can use it well without knowing the implementation details.

Menu