Instead of this str_repeat, use str_pad [1].
I assume this is highly AI generated based on the emoji and the typical structure of README.md? At the very least have it break apart WebServer.php, this is insanely too long, and what's it with all the static stuff?
And the Revolt driver [2] is missing a composer.json with the required dependency, and the code would benefit from a use statement instead of 5 fully qualified references.
[1] https://www.php.net/manual/en/function.str-pad.php
[2] https://github.com/Qbix/webserver/blob/main/src/Q/Evented/Re...
Yes, these days I work with AI (Claude chat, usually) to do all the "last mile" things, like packaging, writing READMEs, etc. I iterate, do quality control, and I asked it specifically to put emojis in titles. But the actual architecture, and the 10+ years of code in the framework, were hand-rolled.
I just realized I can extract the web-server under an MIT license and gift it to everyone. So I put it up on github and then told HN about it. That's all!
PS: I very much appreciate constructive feedback. Your suggestions have been incorporated: https://github.com/Qbix/webserver/commit/618638ecdc9097722fd...
jqpabc123•13h ago
So it is not really a competitive option for serious use.
EGreg•13h ago
This server is not competing with nginx for serving static files. It's competing with nginx+php-fpm for serving PHP, and there, it wins by a large margin.
You might have a very narrow definition of "serious use". This isn't just for people who want to serve static files. This is for people who want to host PHP applications without having to manually install nginx, configure its proxy_pass to php-fpm, etc.
In some ways, in real-world scenarios, this server would actually be faster than nginx with php-fpm. Because it can prefork processes after it has loaded classes, so all that bootstrapping your PHP scripts do having to load classes over and over, (even with PHP's opcode caching) can be on the order of tens of milliseconds. That's saved per call.
You can still put nginx in front of this, by the way, for much faster https. But you can also put CloudFlare, CloudFront, or any other CDN in front of it instead, and get all the advantages of reverse proxies, etc.
But, all by itself, this server handles reverse proxy, caching (including Cache-Control headers, ETags, etc.) and, very importantly, it allows your PHP to do two things that other webservers don't:
1. Send X-Accel-Redirect headers in order to enforce true access control for static files, based on cookies etc. Gone are the days you have to host files publicly at unguessable URLs, that people can share with others.
2. Send X-Cache-... headers that actually let the server cache parts of the page rather than the whole page. When you invalidate one thing, it intelligently invalidates all the pages that transitively depend on that thing.
There's a lot more to it. You commented 2 minutes after it was posted, so I imagine you haven't actually read the README. Go and read it. Yes, it's for "serious use."
Oxodao•13h ago
Just use frankenphp and be done with it, it runs caddy, doesn't need an external php runtime and also lets you bundle your app as a single executable.
EGreg•13h ago
For one thing, developers who actually code in PHP need a web server. This "just works" out of the box. No need to install Go, or Nginx, or php-fpm, or configure proxy_pass, or certificates, etc. etc. Yes, caddy also handles certificates, but what about the rest?
There is a section in the README comparing this to FrankenPHP, Swoole, etc. You can see where this approach actually beats them. In fact, instead of simply declaring "it sux", why not try it first? It takes 5 minutes. Download and launch.
And a word about about safety. FrankenPHP workers persist between requests, which means every static variable, singleton, and global cache in your app -- and every library you use -- becomes a potential data leak between users. Qbix Server gives you the same performance benefit (zero bootstrap cost) via fork-after-preload, but each request gets its own process. When it's done, everything is gone. No audit needed.