Live data from Hacker News

A look at modern PHP

lwn.net

241–250 of 610 posts

Re: A look at modern PHP

#241

Earlier quoted context omitted.

PHP isn't being replaced by Rust or Go. It's being replaced by Medium, Wix, and Squarespace. At this point, the predominant reason it's still undergoing active development is that there is a metric ton of legacy PHP code. As the businesses still using it either mature, evolve, or fail, the need for PHP will begin to dry up. You're defending the language from an emotional standpoint. > choosing php for a new project i…

> This is absolutely not the case, and you know it. Almost every language has a wealth of HTTP tools and frameworks, and many of them come built-in. Lots of languages have HTTP tools and frameworks, but not many of them are even comparable in scope to Symfony or Laravel. Out of curiosity, can anyone point me at some frameworks in other languages that have the following things built-in? * Route matching and dispatch *…

Spring Boot has most of the important parts of this. And super easy to call a library for anything else, or write 10-20 lines of code yourself.

This is all in a performant, reliable and secure compiled language (Java). Language improvements and modern frameworks have also addressed the long-winded code which used to be an issue.

Re: A look at modern PHP

#242
post #169
post #130

Earlier quoted context omitted.

Symfony is an outstanding framework and a real pleasure to build with.

I've moved on from PHP some 5 years ago. I'm not missing the language. But damn I'm missing Symfony! I prefer Scala to PHP, the language is much more expressive. When you want to replace a bit of core functionality, in Symfony, you extend the desired class, add it to the dependency injection container, and you're done. In the Play framework, I once wanted to make a one-line change to the routing. When it turned out I…

Check out Rails (ruby) and Phoenix (Elixir)(Rails' successor, personal favorite of mine). Many frameworks on many languages tried to mimic rails but most failed to achieve desired level of polishing/comfort/completeness/etc

Re: A look at modern PHP

#243
post #164

Earlier quoted context omitted.

So I take it all the things in this article ( https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/ ) are no longer relevant? For example "foo"==TRUE, "foo"==0 and TRUE !=0 are logically consistent now? Or json_encode no longer returns null for invalid input?

Why are you using "=="? Use "===" and make explicit casts as required.

Sometimes "==" is used under the hood ( switch/case i think?) and it's hard to avoid it completely even if you always use "===" in the code

Re: A look at modern PHP

#244
It's sad that php as such a bad rep that I figured I should say "I code in Go. Php? Yeah I can do that too" so I don't get some eye rolling and an instant prejudice I'm a cheap coder. For it's age php is great and pretty easy to setup (having to intall separate modules for imagemagick and cryptography is just a tiny assle). Composer should really solve it's large memory usage problems, but other than that it's pretty good.

It's really good for it's intended purposes and is getting a lot better in latest versions.

Re: A look at modern PHP

#246
post #112

The amount of misinformation, false claims and unsupported statements in this thread is mindblowing for the quality that I've been used to see on HN. Here are some facts: - Symfony was the backend framework with the most contributors in 2019 [1] (yes, out of any backend framework written in any language) - PHP has more active contributors than it ever had [2] - Laravel is one of the most used frameworks in the world…

It is also worth noting the number of packages published on packagist.org [0] (kind of npmjs.com for PHP), which is rapidly growing.

[0]: https://packagist.org/statistics

Re: A look at modern PHP

#247

Earlier quoted context omitted.

> It's always the same arguments, that $newHipLanguage will replace it. It's not that a new language will replace it. It's that the people that hire PHP to solve their problem will now use a platform with no code to manage. Engineers writing platforms will choose languages other than PHP to write them. You can't spin up multiple request threads to make concurrent non-blocking queries in PHP.

- You can't spin up multiple request threads to make concurrent non-blocking queries in PHP You mean that you don't know how to: https://github.com/amphp/amp

It's not built into the language? How can we be sure this project with 2k Github stars won't segfault, memleak, deadlock, or have some other horrible bug [1]? I haven't done full due diligence, but I'm already suspicious. The open tickets don't look good [2].

> You mean that you don't know how to

I'm not convinced you found an appropriate answer either.

In any case, this should be a language feature.

[1] It looks like it relies on bindings to an unofficial native code extension.

[2] https://github.com/amphp/amp/issues/300

Re: A look at modern PHP

#248

Earlier quoted context omitted.

I can't really understand the hate towards php in general, never was able to understand it. I started programming in PHP and then moved to c# and now mostly JS, but never really understood the motivations behind people bashing on PHP. Like, some of my friends that today mostly program in React/Nextjs praise the framework as something amazing and the SSR as something really innovative, and - honestly - it resembles PH…

no PHP framework is similar to the thing that NextJS/Reactis doing. The output is the same (well, isn’t the point of web framework is to spit out HTML?) but the methodology is totally different.

And about 100x more complex and fragile.

Re: A look at modern PHP

#249
post #144

Earlier quoted context omitted.

X sometimes stands for problems above technical problem, such as: - Existing team is comfortable with using PHP - Existing project is tightly coupled PHP monolith - Existing project cannot be migrated to other language fast enough if needed All are valid and justifiable reasons. Learning new language is not the easiest and we should think of the people. I must emphasis though, all party must not freeze in time. They…

Sure, but sometimes X is something like you have a video and you want to use the GPU to analyze it and the best library for that is in C and there are great python bindings. So a professional developer would use C or Python and not waste his client time by trying to create it's own unmaintainable CoolLang bindings (where this dev is just now learning CoolLang and there are not that many people that know CoolLang). Ev…

You can do this in Spring Boot/ Java, with one Java class and one config file.

And it will likely be an order of magnitude more scalable & reliable than the PHP, having proper logging, security features, etc.

Whereas such PHP systems in my experience tend to be unreliable, in need of maintenance and often broken.

The Java/ Spring Boot option will also take you all the way to a high-end commercial system/ large website/ webapp.

Re: A look at modern PHP

#250
post #215

Earlier quoted context omitted.

> This is absolutely not the case, and you know it. Almost every language has a wealth of HTTP tools and frameworks, and many of them come built-in. Lots of languages have HTTP tools and frameworks, but not many of them are even comparable in scope to Symfony or Laravel. Out of curiosity, can anyone point me at some frameworks in other languages that have the following things built-in? * Route matching and dispatch *…

You have to understand, all of that is irrelevant! Because PHP is old and shitty, it mixes camel_case and SnakeCase and the order of arguments in the standard library is inconsistent! Bah.

camelCase and snake_case

... Just to avoid confusion

Post reply on HN