Live data from Hacker News

The Rise of Hybrid PHP: Blending PHP with Go and Rust

yekdeveloper.com

141–150 of 158 posts

Re: The Rise of Hybrid PHP: Blending PHP with Go and Rust

#141
post #138

Earlier quoted context omitted.

NodeJS is, like, 10 steps back from PHP 8. Worse type system, less safe, package ecosystem is a hot mess, slower... I mean the list goes on and on. We can "lipstick pig" a lot of those problems by using typescript or whatever, but now we're compiling JS and the output isn't even fast. At that point use a competent compiled language like C# or Rust.

As someone who is not a fan of npm/ts I must say I find this almost delusional. TS is way better than PHP and node is much faster.

TS type system is virtually identical to PHP - structurally typed, union types, etc. I don't know why people think PHP is untyped - it's not 5.4 anymore. The type system is very full featured.

The difference is TS has to be compiled, PHP doesn't. If we have to compile stuff we might as well use a more safe language like C#.

Also no, Node is not fast. I don't know why people think Node/JS is fast. JS has very poor performance characteristics and it can't be fixed because it's a factor of the language design - although, PHP has similar problems.

Chromium is very optimized, for specific scenarios. Its still a dynamically typed, garbage collected language - and optimizing a for loop in a play pretend medium blog doesn't change that.

Re: The Rise of Hybrid PHP: Blending PHP with Go and Rust

#142
post #53

Earlier quoted context omitted.

Web frameworks for me are one of those things that's "great until it isn't". If you're making a simple app then web frameworks can feel downright magical (like the original "Build a blog in 15 minutes with Rails" demo [1]), but for anything that gets even remotely complicated, I find that they generally just get in the way. I personally have grown to prefer the "mid-level" HTTP setups, like Express with Node.js or Ve…

[1] https://www.youtube.com/watch?v=Gzj723LkRJY

oops, sorry. Forgot to attach it...thanks!

Re: The Rise of Hybrid PHP: Blending PHP with Go and Rust

#143
post #138

Earlier quoted context omitted.

As someone who is not a fan of npm/ts I must say I find this almost delusional. TS is way better than PHP and node is much faster.

TS type system is virtually identical to PHP - structurally typed, union types, etc. I don't know why people think PHP is untyped - it's not 5.4 anymore. The type system is very full featured. The difference is TS has to be compiled, PHP doesn't. If we have to compile stuff we might as well use a more safe language like C#. Also no, Node is not fast. I don't know why people think Node/JS is fast. JS has very poor per…

> Also no, Node is not fast. I don't know why people think Node/JS is fast

Node is not fast. It's faster than PHP and that is very clear.

The most cursory search and hands on experience will tell you that.

Re: The Rise of Hybrid PHP: Blending PHP with Go and Rust

#144
post #129
post #75

Earlier quoted context omitted.

Yeah, I use php colab all of the time to run numpy stuff on gpus, I learned about it in my php data science class in university. They’re basically equivalent now.

>I learned about it in my php data science class in university. I rest my case...

Ah, another data scientist, I should have known.

Re: The Rise of Hybrid PHP: Blending PHP with Go and Rust

#145

FrankenPHP sounds promising, but in reality it is a weirdo: no one uses PHP without modules. Where is the list of PHP modules supported by FrankenPHP? Is it possible to compile it with some extra PHP modules? How? I see it is tightly bound to Caddy. I am not much familiar with that webserver, I would prefer nginx, but there's not a single guide mentioning if that's possible to use nginx with FrankenPHP (as a php-fpm…

static build, is built by default with these modules :

amqp,apcu,ast,bcmath,brotli,bz2,calendar,ctype,curl,dba,dom,exif,fileinfo,filter,ftp,gd,gmp,gettext,iconv,igbinary,imagick,intl,ldap,lz4,mbregex,mbstring,memcache,memcached,mysqli,mysqlnd,opcache,openssl,password-argon2,parallel,pcntl,pdo,pdo_mysql,pdo_pgsql,pdo_sqlite,pdo_sqlsrv,pgsql,phar,posix,protobuf,readline,redis,session,shmop,simplexml,soap,sockets,sodium,sqlite3,ssh2,sysvmsg,sysvsem,sysvshm,tidy,tokenizer,xlswriter,xml,xmlreader,xmlwriter,xz,zip,zlib,yaml,zstd

https://github.com/php/frankenphp/blob/main/build-static.sh#...

Re: The Rise of Hybrid PHP: Blending PHP with Go and Rust

#146
post #38

Earlier quoted context omitted.

Right on, I wrote a lot of PHP 15 years ago and I swore I’ll never get back to it. I’m a much better developer now and I’ll actively avoid any company doing PHP in 2025.

PHP is a very different language than 15 years ago, and large applications are pretty much indistinguishable from Java or dotnet. The type system is more cohesive than JS or even Python at this point.

But still, why would I work with it? The language is crap, I guess now there are enough abstractions to hide it but they can do only so much. You're still writing $variables and calling the array_* methods etc. at some point. I'd rather work with languages that don't have this legacy crap with them. I also avoid Perl fwiw.

Re: The Rise of Hybrid PHP: Blending PHP with Go and Rust

#147

Earlier quoted context omitted.

The reason Go does not have a grand framework is that the language has a severely underdeveloped type system, which makes building complex libraries that meaningfully complement each other overly difficult. I waited nine years before starting on my first Go database toolkit so I could use generics. I succeeded, but can't shake the feeling that I know I had a better experience doing it with Java in undergrad. Being ab…

I think the Java stream API is amazing, and I do like that. Not having the equivalent of hibernate level ORMs is not a disadvantage for me personally, just because I don't like ORMs - Asking chatgpt to spit out some SQL and mapping code for me and being able to tweak the actual SQL over time is preferable (but again that is just my preference). I don't really agree with the idea that Go has an underdeveloped type sys…

Is it possible that some of the mismatch in how people view Go's type system is due to experiences differing from writing applications vs writing libraries? I personally find some of the repetition in Go code to be tolerable when writing web applications and CLI tools, but a real issue for the composability of libraries with different purposes. Going back to the database toolkit example, the query builder can easily return a result type, but what if I also want to handle validation of input before the query and then later return a HTTP response? Well to chain a result type end-to-end in Go requires it to have knowledge of all the different types/interfaces that it could map to, which I believe is way too broad of a responsibility for one type, even though all of those features feel as though they could very naturally chain together and reduce down to a single error. These kinds of type limitations effectively force Go libraries to live on their own islands where they don't compose with one another.

Re: The Rise of Hybrid PHP: Blending PHP with Go and Rust

#148
post #143

Earlier quoted context omitted.

TS type system is virtually identical to PHP - structurally typed, union types, etc. I don't know why people think PHP is untyped - it's not 5.4 anymore. The type system is very full featured. The difference is TS has to be compiled, PHP doesn't. If we have to compile stuff we might as well use a more safe language like C#. Also no, Node is not fast. I don't know why people think Node/JS is fast. JS has very poor per…

> Also no, Node is not fast. I don't know why people think Node/JS is fast Node is not fast. It's faster than PHP and that is very clear. The most cursory search and hands on experience will tell you that.

I don't think Node is faster than PHP because you can pretty aggressively optimize PHP. Between opcache cache, hot interpreters, JIT, frankenphp...

Chromium optimizes JS, sure, but not for that use case. It optimizes it for the frontend. I'm sure a huge part of that is how fast you can compile it - which means less aggressive optimize. I'm sure chromium absolutely does not optimize for long-lived JS processes.

Although, to be fair, I don't actually know which is faster. Just based off of my own experience, JS has been shockingly slow, and PHP quick in production. But that could be React clouding my view.

All in all, JS and PHP are pretty similar. The same stuff that makes JS slow is the stuff that makes PHP slow. Its not like JS has some magic sauce to turn an interpreted dynamically typed language into a performant one.

Re: The Rise of Hybrid PHP: Blending PHP with Go and Rust

#149

Earlier quoted context omitted.

PHP is a very different language than 15 years ago, and large applications are pretty much indistinguishable from Java or dotnet. The type system is more cohesive than JS or even Python at this point.

But still, why would I work with it? The language is crap, I guess now there are enough abstractions to hide it but they can do only so much. You're still writing $variables and calling the array_* methods etc. at some point. I'd rather work with languages that don't have this legacy crap with them. I also avoid Perl fwiw.

Every language has legacy crap, or at least all the ones that matter.

Re: The Rise of Hybrid PHP: Blending PHP with Go and Rust

#150

Earlier quoted context omitted.

PHP has a much more competent type system than JS and is overall more ergonomic IMO. Typescript exists, but if I'm compiling something I'm using a real language or framework like dotnet. There's no reason for me to use typescript and node and install 100 packages when I can just install dotnet.

install dotnet, and install 100 packages for .net core, asp.net, identity, ef, etc. Don’t kid yourself. While strongly typed languages are great. I like to be able to get things done. This is why I don’t C++ anymore. This is also why I don’t dotnet anymore. Too much BS with the type system and correctness and the Microsoft way or lack of support or rug pull. They lost me when they killed XNA. Typescript is actually g…

dotnet is a batteries included framework... It has way more included than any other language, including JS and PHP.

> I want a C++, with Types, with memory safety, with garbage collection, with pointers, with a dev experience like dotnet, but we don’t have those things.

Dotnet, you want dotnet. Dotnet has all of those. Yes it has pointers.

Post reply on HN