On Sat, Nov 1, 2014 at 1:40 PM, Andrea Faulds <a...@ajf.me> wrote:
> > On 31 Oct 2014, at 18:37, Larry Garfield <la...@garfieldtech.com> wrote:
> > IF internals wanted to add implementation, not just improving streams, 
> > something like the following would be much more useful:
> >
> > $request = http_get_request(PHP_STDIN); // or something
> >
> > Where $request is an object that implements the PSR-7 RequestInterface (or 
> > at least the read-only parts of it), or something similar.  Then 
> > implementers can compose that object however they want.
> > [...]
>
> This sums up my thoughts on this very well. Nobody needs to change how we 
> parse the data. We just need better access to the results of the parsing.

Alternatively, what I would see as extremely useful would be to be
able to expose the "main loop" of the SAPI. Have a way (via an ini
mechanism) to register a callback that is executed when a requests
start processing. Essentially, similar to what is provided by WSGI
(for Python) and Rack (for Ruby).

The default implementation would be something like:

<?php
function default_entrypoint($env) {
  php\register_superglobal($env);
  php\execute_script();
}
?>

(with this callback executed in the scope of the new request)

But you could override any of it if you wanted to, and that would pave
the way nicely to more advanced PHP SAPIs (possibly evented) down the
road.

Damien

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to