Live data from Hacker News

Moving from Go to PHP Again

dannyvankooten.com

61–70 of 371 posts

Re: Moving from Go to PHP Again

#61
post #2

For the kinds of applications people tend to build in PHP, PHP is probably a better choice than Go. I'd still do Django or Rails before PHP, but Go just isn't designed to make serverside-rendered database-backed websites especially pleasant to write.

> Go just isn't designed to make serverside-rendered database-backed websites especially pleasant to write.

Citation needed. I’ve had a very nice time. It’s statically typed, has excellent templating support, and is generally very productive.

Re: Moving from Go to PHP Again

#62
post #13

Each PHP file is an endpoint. As opposed to having routers in code or client side SPA routing. PHP files can be deployed independently, swapped out or updated live. No building/compiling of the php files needed. A single layer as opposed to 'modern architecture' where there's client side back/front end layers, api layer, logic, validator, data access, and ORM layers. Can extend itself as it runs. For example Wordpres…

>Amazon lambda may have more in common with PHP in terms of discreet deployable units of functionality. What's old is new again.

This doesn’t seem to be a language choice problem, it seems to be a monolith problem, where PHP simply managed to avoid some of the traditional monolith issues by design. Your CD pipelines in any micro service architecture should solve these problems, whether it’s using FaaS or containers, or whether it’s using a compiled language or an interpreted one.

Re: Moving from Go to PHP Again

#63
PHP is the same but with speed improvements in 7. But even without that the sheer number of high traffic sites built on PHP and proven scalability cannot be ignored or its ease of use and setup.

All talk of accessibility and ease for new users often comes off as posturing by some tech folks who then proceed to rubbish any efforts at achieving it and the compromises involved. It fits in nicely with the 'contempt culture' recently covered here.

The growing problem for the technical community and new users is the marketing by other languages, frameworks and those vested in these ecosystems which means using forums like this to belittle, rubbish and exaggerate any perceived fault in everything else. PHP's contemporaries like Python, Ruby, Javascript have their many downsides too but these efforts create false binary narratives. This is not a good basis for technical decisions or informed discussion.

Re: Moving from Go to PHP Again

#64
post #13

Each PHP file is an endpoint. As opposed to having routers in code or client side SPA routing. PHP files can be deployed independently, swapped out or updated live. No building/compiling of the php files needed. A single layer as opposed to 'modern architecture' where there's client side back/front end layers, api layer, logic, validator, data access, and ORM layers. Can extend itself as it runs. For example Wordpres…

> Each PHP file is an endpoint. As opposed to having routers in code or client side SPA routing. Which becomes a security issue due to accidental endpoints or uploads becoming endpoints. Or becomes a mess of imports. Either way, PHP frameworks often end up with a central router anyway. > PHP files can be deployed independently, swapped out or updated live. Which means some people try to do that the naive way and end…

You can create a mess of code, open security holes, and/or be hit with ‘gotchas’ in any web framework. PHP is much less complex than most.

Re: Moving from Go to PHP Again

#65
post #19
post #11

Earlier quoted context omitted.

Hm, I hate to be on the bandwagon, but why WordPress? One of the things that has made PHP become what it is today is a focus on good software engineering and the introduction of language features that are required by that. WordPress did not keep up on the engineering front and there are so many amazing options out there now for well written, well engineered platforms. Even in pre-built blog platforms. You're not alon…

I am completely out of the loop here. All I know is that I really disliked Wordpress and really-really disliked Drupal back in the day. Can you mention some of the better alternatives? Once in a while a PHP CMS is what I gotta deal with and I dread it, because of the said systems.

As a developer use ProcessWire instead of all the others.

Imho the best CMS for PHP.

Re: Moving from Go to PHP Again

#66
post #61
post #2

For the kinds of applications people tend to build in PHP, PHP is probably a better choice than Go. I'd still do Django or Rails before PHP, but Go just isn't designed to make serverside-rendered database-backed websites especially pleasant to write.

> Go just isn't designed to make serverside-rendered database-backed websites especially pleasant to write. Citation needed. I’ve had a very nice time. It’s statically typed, has excellent templating support, and is generally very productive.

Well, they thought Go would be an alternative to C++ (1) which has never really been the most popular website backend language.

I'm glad it's working out for you, but I don't think it's a stretch to say it wasn't really designed for it. On its own, that doesn't mean it's a bad fit; but I agree with your parent and think it's awful for this type of stuff.

(1) - https://commandcenter.blogspot.com/2012/06/less-is-exponenti...

Re: Moving from Go to PHP Again

#67
post #38

Earlier quoted context omitted.

Symfony and Laravel are really nice. It's still a horrible abomination of a language that invites bugs and requires A LOT of care to not produce buggy code, though.

Does it? If you declare strict, use strict comparison operators and typehint your arguments and returns, what more care do you need? These are not particularly onerous, the strict declaration is trivially templateable in any editor as it's the first line, you'd write types in any language and getting used to only use === !== and forget == and != is ... easy?

What's the equivalent of === for in PHP?

Re: Moving from Go to PHP Again

#68
I agree with the author. Symfony 4 is the best PHP framework at the moment.

Trying both Laravel and Symfony I think there is no need for Laravel (anymore). Laravel just has too much magic that will bite you later on.

The only thing you should skip in both frameworks are 'annotations'. But this is easy to do.

Re: Moving from Go to PHP Again

#69
post #13

Each PHP file is an endpoint. As opposed to having routers in code or client side SPA routing. PHP files can be deployed independently, swapped out or updated live. No building/compiling of the php files needed. A single layer as opposed to 'modern architecture' where there's client side back/front end layers, api layer, logic, validator, data access, and ORM layers. Can extend itself as it runs. For example Wordpres…

Apache MultiViews makes pretty URLs easy. www.example.com/widgets.php can be reached at: www.example.com/widgets But here's the kicker: www.examples.com/widgets/123 will also route to widgets.php, with "/123" in the $_SERVER['PATH_INFO']. No mod_rewrite needed. www.example.com/widgets/you/can/have/multi-segment/paths goes to widgets.php too, with its PATH_INFO set to "/you/can/have/multi-segment/paths", but I don't u…

Caveat: there are cases where this behavior has resulted in vulnerabilities. e.g., CVE-2018-10661[1]. So if you ever want to implement your own auth module in apache httpd you should be aware of this.

[1] https://www.vdoo.com/blog/vdoo-discovers-significant-vulnera...

Re: Moving from Go to PHP Again

#70
post #61
post #2

For the kinds of applications people tend to build in PHP, PHP is probably a better choice than Go. I'd still do Django or Rails before PHP, but Go just isn't designed to make serverside-rendered database-backed websites especially pleasant to write.

> Go just isn't designed to make serverside-rendered database-backed websites especially pleasant to write. Citation needed. I’ve had a very nice time. It’s statically typed, has excellent templating support, and is generally very productive.

In go, Querying SQL is very much like doing the same thing with the base libraries for mysql in C. Doing the same in most any other language is much much easier and just as safe.

Credentials: Worked mainly in go for 4 years... 18+ years coding in about 9 languages.

Yes I realized this is opinion.

Post reply on HN