Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What do they want async for? PHP's purpose is to run once to generate one HTTP response - they'd already forgotten this by inventing frameworks, but adding async seems to especially have forgotten this.

PHP already had curl_multi_perform which is very useful for running child tasks, but I'm not sure you need much more than that.



The usual asynchronous stuff like fetching data from two APIs to then prepare the HTML response to the user. Today, it's sequential, which is fine for DB calls to localhost, but less fine with API calls.


Well that’s one purpose of php.

My workloads involve billions of php executions daily that have nothing to do with http or Apache or serving pages. Lambda and cli based jobs mainly.

PHP can do a lot of things if you stick with it and don’t jump to the next shiny object. Async helps with this.


People also use PHP to write backend scripts, without web use at all.

While the original and primary purpose may have been for personal home pages, it has evolved considerably since then. Consider an accounting/aggregate billing script for a PHP application that runs on a scheduler. That isn't dependent on the web necessarily, but it does interface with the moving parts of the overall application. Async would be great here.


Another use of async is to build other kinds of servers like websockets, which need to hold long-term connections. ReactPHP + Ratchet works great for that in PHP. Currently it works with an event loop (multiple implementations under the hood, like libev, libuv, etc) similarly to Node. Fibers should make the internals of ReactPHP better, but it'll barely change anything in userland.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: