4 ms·
For the past few years I've been building a B2B SAAS. Naturally I've chosen my "get shit done" language PHP to do it. While the product itself is as boring as i
by phoboslab 2y ago
For the past few years I've been building a B2B SAAS. Naturally I've chosen my "get shit done" language PHP to do it. While the product itself is as boring as it gets, I've had stretches of good fun with it by building _everything_ myself.
Naturally the web frontend is written in PHP, so are the cronjobs, shell scripts, message queues, WebSocket server, client software, statistics and the server automation (think Ansible, but imperative). Sharing my own libraries between all these parts is extremely valuable. Owning the whole stack means I never have to deal with black boxes or fiddle with dependency management. The language just gets out of the way so you can solve your actual problems.
The fact that PHP is reasonably good at all these things is a big advantage. The performance is certainly good enough (never became a problem) and the long running server applications (e.g. the WebSocket servers) are rock solid.
- bpfrh 2y agoI'm curious on how you did the websocket part? I thought php has a per request execution model.
- askonomm 2y agoIt doesn't have to. Laravel Octane (or Swoole, OpenSwoole, FrankenPHP) support serving multiple request with just one process.
- nolok 2y agoIt used to. Hell, in PHP 5 era and before, it even HAD to, PHP had been designed as "you get a brand new process every request" and so a lot of things with memory went wrong if you ran for too long. This changed with PHP 7, some framework appeared to allow an event based system, and then PHP 8 (or a later minor update) added fibers to the core to support it more easily. These day, event based php has several well supported frameworks, is stable and fast, and allows you to have the same codebase on your websocket or other event system as you use on the rest of your app (sharing libraries is super cool, using the same DTO on the sender and receiver also, etc ...)
- DonHopkins 2y agoDoes it also run in the browser, so you can share type definitions and libraries and tools between client and server, and seamlessly perform isomorphic server side rendering? If only there were a language that was as universally deployed and well supported and extremely optimized on both server AND client, and had all of the capabilities of PHP and many more... Because today, using an anisomorphic language that can't run on both sides is like riding a bicycle with only one leg. https://en.wikipedia.org/wiki/Isomorphic_JavaScript https://en.wikipedia.org/wiki/Isomorphic_JavaScript https://kit.svelte.dev/ https://kit.svelte.dev/
- nolok 2y agoOh I would agree but Javascript is anything BUT stable in its environnement and frameworks etc... Trying to update a one year old php code base with composer means no issue at the end in 99% of the time. Javascript's ecosystem is not anywhere that yet.
- DonHopkins 2y agoOh don't worry, some day JavaScript will as stagnant as PHP, too. Just wait, time flies. If it's a stable environment that runs old code you want, then if I had my way we'd all be programming interactive distributed network extensible web apps in PostScript instead of JavaScript, and that language has been stagnant for a much longer time than PHP has ever existed (13 years before PHP 1.0 was released in 1995), since you can still print and view all of your old PostScript documents from 1982, 42 years ago. HyperMedia browser with embedded "applets" in PostScript: https://donhopkins.medium.com/hyperties-discussions-from-hacker-news-937d156f0330 https://donhopkins.medium.com/hyperties-discussions-from-hac... HyperCard-like GUI builder and SimCity in PostScript: https://donhopkins.medium.com/hyperlook-nee-hypernews-nee-goodnews-99f411e58ce4 https://donhopkins.medium.com/hyperlook-nee-hypernews-nee-go... Visual programming language in PostScript: https://donhopkins.medium.com/the-shape-of-psiber-space-october-1989-19e2dfa4d91e https://donhopkins.medium.com/the-shape-of-psiber-space-octo... Owen Densmore's description of John Warnock's "Linguistic Motherboard": https://news.ycombinator.com/item?id=29295116 https://news.ycombinator.com/item?id=29295116 Owen Densmore's object oriented PostScript programming system: https://news.ycombinator.com/item?id=18696116 https://news.ycombinator.com/item?id=18696116 Brian Reid's history of JaM, Interpress, and PostScript: https://news.ycombinator.com/item?id=37202149 https://news.ycombinator.com/item?id=37202149 PostScript's relation to Forth, Lisp, and Smalltalk: https://news.ycombinator.com/item?id=21968175 https://news.ycombinator.com/item?id=21968175 PostScript's relation to PDF: https://news.ycombinator.com/item?id=37202149 https://news.ycombinator.com/item?id=37202149 Alan Kay on "Should web browsers have stuck to being document viewers?" and a discussion of Smalltalk, HyperCard, NeWS, and HyperLook: https://donhopkins.medium.com/alan-kay-on-should-web-browsers-have-stuck-to-being-document-viewers-and-a-discussion-of-news-5cb92c7b3445 https://donhopkins.medium.com/alan-kay-on-should-web-browser...
- bartimus 2y agoPHP has had socket_select since PHP4
- matrss 2y ago> think Ansible, but imperative For basically all purposes ansible is imperative.