Re: RFC: Server-Side Request and Response Objects (v2)

From: Date: Thu, 12 Mar 2020 14:33:23 +0000
Subject: Re: RFC: Server-Side Request and Response Objects (v2)
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-108996@lists.php.net to get a copy of this message
Hi all, > On Mar 11, 2020, at 11:36, Paul M. Jones <pmjones@pmjones.io> wrote: > > Conversation on this RFC seems to have diminished. As far as I know, I have answered all > criticisms/concerns/complaints one way or another. FWIW, I have updated the Q&A points based on new discussion over the past day or so. The updated points are: Q: The proposal compares and contrasts with HttpFoundation and the various PSR-7 implementations; how does it compare to other projects? A: See this message for a starting point: https://externals.io/message/108436#108889. In short, the proposed functionality is representative of functionality common to the dozen-plus researched projects. Q: Are these global single-instance objects? A: No, you can create as many instances as you like, in whatever scopes you like. Q: Do these objects replace the superglobals? A: No. Q: Do these objects deal with $_SESSION and the session functions? A: No; it is explicitly out of scope for this RFC. Q: Readonly properties are unusual for PHP. A: Granted, though not unheard of. PdoStatement::$queryString is one precedent here. Further, of the researched userland projects, more than half of them present the relevant superglobals as nominally readonly in the public scope, making readonly access a reasonable choice here. Q: Why is ServerRequest readonly, and ServerResponse mutable? A: It makes sense that you would not want to change what you have received as a request; however, as you are in charge of creating the response, modifying it as needed seems reasonable. Further, the “readonly request with mutable response” matches half or more of the researched userland projects. Q: What would a migration path look like? A: Something like the one outlined in the later portion of this message: https://externals.io/message/108436#108893 -- Paul M. Jones pmjones@pmjones.io http://paul-m-jones.com Modernizing Legacy Applications in PHP https://leanpub.com/mlaphp Solving the N+1 Problem in PHP https://leanpub.com/sn1php

« previous php.internals (#108996) next »