Hello, Michael Morris > Coming back to your proposal, While I'm very aware of the async pattern from > its use in JavaScript and C#, I don't quite get where it will be useful in > PHP. > My experience with PHP is that it responds to HTTP requests and that stepping > over a function that hasn't finished its output isn't helpful because you > aren't really saving any time in that request thread as it has very defined > start > and end points. But we write PHP scripts the way we do because of how > the language is structured.
In the PHP community, there were developers who started using PHP for stateful applications. It seems that Workerman was the first. Then Swoole appeared, which turned PHP into the same thing Node.js turned JavaScript into. Swoole introduced several key features: 1. A built-in HTTP server 2. Coroutines 3. Workers 4. The ability to use standard PHP functions directly inside coroutines This made it possible to use a single PHP process to handle multiple requests, increasing CPU utilization, reducing memory usage, and lowering the number of processes. In certain scenarios, Swoole + JIT PHP performs no worse than Go. This gave companies with legacy PHP projects the ability to avoid rewriting everything in Go. Remember the hype around Node.js a few years ago? “Node.js is better than PHP, it outruns PHP.” JavaScript itself didn’t become faster, but its async model allowed developers to build more responsive applications with low latency. The secret of that performance boost is exactly the combination of stateful architecture and coroutines. This formula became the holy grail of modern backend applications. Swoole went even further and created an entire software ecosystem that not only made PHP asynchronous but also provided a full set of standard tools for modern backend development. Swoole could have given the language a huge push forward, especially if Symfony and Laravel had adopted it. PHP had a very good chance to compete with Go in the API market, offering simpler development and a large set of ready-made solutions. This is what an alternate universe of PHP could have looked like: a PHP that people would finally stop considering a second-class language. ... It seems I got a bit too carried away dreaming :) I’ll go turn off my imagination now… In other words, it is the absence of asynchrony in the language that is the problem seriously slowing down further development. PHP has a theoretical growth limit in its current form, and it has not yet been reached. > Just, don't give up and don't get frustrated. It's hard. You can still read > the Drupal discussion on runtime assertions. > I got rather testy at times after explaining the same thing for the 12th > time. But I didn't take it personal and when my emotions needed checking I'd > step away for a few hours. Thank you for the support. --- Ed
