Live data from Hacker News

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

yekdeveloper.com

91–100 of 158 posts

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

#91

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…

> The reason Go does not have a grand framework is that the language has a severely underdeveloped type system Counterpoint: PHP. PHP 5.3 had an even less capable type system, but developed several usable frameworks.

That's a complimentary point, not a counterpoint. I'm talking about Go's type system being restrictive. PHP and many other languages avoided that particular trap by allowing variables to be reassigned to any type. Java and many other languages went in a different direction and instead chose to build more complete type systems.

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

#92

I'm starting to build a bit of antagonism to all-encompassing frameworks (e.g. Spring, Larvel, Phoenix, etc.), because while they are productive to build new things with, I seem to always have the same issue on legacy projects built with them. It always seems to be a challenge to upgrade dependencies for these projects. Its usually because (in building the thing) one can't fully follow the "prescribed" way of doing t…

In Laravel, the issue is that the framework is sold as "productive" as default. There is no real "beef" to the framework though, IMO. It is better today, but historically it is just a wrapper around symfony with some dependency injection through reflection, questionable serde, tons of magic, and with some unique takes on templates and routing, which are arguably not very good takes? Maybe components are better, but blade in general seems backwards as a template language.

Ever want to type `$model->foo instead of $model->getFoo()` but then have `$model->foo` magically call `$model->getFooAttribute()`, but fall back to `$model->getAttribute('foo')` if that method doesn't exist? Then that magically calls some casting methods, and possibly even fetches infinite records from a remote store? It is so artisan, bro. I can tell you more if you got five minutes.

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

#93
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 replacement). Also, either Caddy itself, or FrankenPHP's docker image is quite opinionated in regards to using let's encrypt certificates and it is not trivial at all how to make it work via HTTP (if something external would provide SSL) or using own certificate.

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

#94

Pasir is like frankenphp, but in Rust. Very promising, but still early in development: https://github.com/el7cosmos/pasir Which uses the following Zend API bindings for Rust: https://github.com/davidcole1340/ext-php-rs There's also all sorts of interesting experiments, like ngx-php, which basically embeds PHP via Zend API inside an nginx binary: https://github.com/rryqszq4/ngx-php And workerman, which has a hybrid ba…

Does any of this have some kind of support of existing PHP modules?

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

#95

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…

> FrankenPHP sounds promising, but in reality it is a weirdo: no one uses PHP without modules.

You usually build the modules yourself in the Dockerfile, for example for the "pgsql" module:

    RUN apt-get update && apt-get install -y libpq-dev && docker-php-ext-install pdo_pgsql && apt-get remove -y libpq-dev && rm -rf /var/lib/apt/lists/*
And for http, you just put the following in the Caddyfile:

    http://:80 {
        # rest of the Caddyfile directives
    }

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

#96
post #52
post #15

The one thing I don't like about PHP is that the whole application is bootstraped (and autoloading and the configuration is re-evaluated) in every single http request. Sure thing there's cache and all, but it just doesn't feel right (compared, to, for instance, an http server written in golang)

This is one of the best things about PHP IMO. It makes it very easy to scale out.

Yup. No shared state by default.

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

#97

I do this with Perl. One of the reasons I like Perl is because of its high committment to backwards compatibility. I like PHP because it's so easy to set up an installation of my app, but the breaking changes have bit me hard in the past, so I try to minimize its use. Together, it's a great combo.

How is php easy to setup?

Step 1: Copy the files.

Step 2: (There is no step 2.)

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

#98

I'm starting to build a bit of antagonism to all-encompassing frameworks (e.g. Spring, Larvel, Phoenix, etc.), because while they are productive to build new things with, I seem to always have the same issue on legacy projects built with them. It always seems to be a challenge to upgrade dependencies for these projects. Its usually because (in building the thing) one can't fully follow the "prescribed" way of doing t…

> It always seems to be a challenge to upgrade dependencies for these projects. Its usually because (in building the thing) one can't fully follow the "prescribed" way of doing things with the god framework, because each project has to deal with a niche infrastructure environment and/or business context that requires some hack or additional dependency. Then when you need to, say, upgrade a language version, you can't follow the god framework's guide for doing this (if there even is a decent one) because it will break your workaround. So you end up with this hodgepodge which never gets updated until it reaches a critical point where it cannot continue to run on your infrastructure, and it forces a big migration project.

Can you give any specific examples?

I'd like to see which of these are open source. And whether or not they're funded for maintenance.

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

#99

Earlier quoted context omitted.

Thinking about user seeing pixels is seeing just a part of the picture. As all software projects you don't optimize just for immediate user experience but also development time. Time to first draw rarely coincides with development time.

And I don't care about pixels; I want to see structured documents. How I choose to view those is my business.

Got it, you don't care about how the sausage is made. That's totally fine.

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

#100

I owe a large part of my career success to PHP when I learned it back in the day. But recently I picked it up because I had to do some maintenance work and The package management experience was really, really bad. I really think there's a big opportunity for somebody to create the astral.sh for PHP. With a proper package manager, PHP can do way more than what it presently can.

What did you find bad about composer?
Post reply on HN