Live data from Hacker News

A look at modern PHP

lwn.net

551–560 of 610 posts

Re: A look at modern PHP

#551
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…

The thing is, when I started using PHP in 1999, PHP had real advantages that no other eco-system offered. Regarding functionality, it had an "all in one" philosophy, whereas Perl had exactly the opposite attitude. With Perl, the first thing you had to do was research which modules you would have to download and install, but with PHP you could just start writing code. This was in the era before modern package managers…

Hey Lawrence,

Thanks for this detailed comment and the historical background, it is very informational!

Re: A look at modern PHP

#552
post #371

Earlier quoted context omitted.

I have similar experience. Left when it was still 5.* something. Now I mainly do TypeScript/JavaScript and some Rust on the side. To me, PHP was more of a limiter rather than painful experience (it was a bit painful though). I couldn't imagine how to even make a chat app. If not for my moving out of PHP to NodeJS now I wouldn't be a software architect and explore the rest of the fun and challenging part of computing…

I started out with PHP at a very very young age and eventually moved on to other platforms (mainly Python). Not looking to question your experience - but actually recalling my own. Making a chat app was one of the first things I did. It was a super basic CRUD app mixing HTML and some code, refreshing the page every few secs, thanks to some meta tags. Of course, it used frames, so that the "send message" part didn't c…

Http polling came across my mind, but I always thought "No I won't do that". But in my noob mind it was full of http overhead and it must be ws like interaction. Apparently it was a thing, Facebook and a lot others use it.

And laravel, it was everything I knew. I really liked it, the orm was superb, the template engine was superb. It has it downside though, the big amount of code need to be parsed.

Re: A look at modern PHP

#553

As someone who has programmed PHP professionally for 13+ years (and also JS and Python) I have never run into anyone who can place a solid argument since the PHP 7 + Laravel. -- Let me clarify, PHP is useful with context. For building web apps. Each language has its best-uses. Laravel has the strongest ecosystem and community out of any language/framework combo I've seen. I can literally setup and deploy a laravel ap…

> Do you remember Javascript before Node/React? Or before jQuery/Prototype? It was _trash_.

Anyone remember Dynamic Drive DHTML? http://dynamicdrive.com/

Re: A look at modern PHP

#554

As someone who has programmed PHP professionally for 13+ years (and also JS and Python) I have never run into anyone who can place a solid argument since the PHP 7 + Laravel. -- Let me clarify, PHP is useful with context. For building web apps. Each language has its best-uses. Laravel has the strongest ecosystem and community out of any language/framework combo I've seen. I can literally setup and deploy a laravel ap…

I agree to the point you're mentioning industry standard. PHP is not considered in the enterprise environment, simply for all it's flaws and it's security vulnerabilities and still has the same problems as before. Most languages don't have those problems.

Re: A look at modern PHP

#555
post #518

Earlier quoted context omitted.

> Why would RoR bake payments support into the framework? I'm not saying they should, just comparing features for the sake of demonstrating that the functionality that's present in modern PHP frameworks isn't readily available in just any random framework in any random language.

This is the same kind of argument used to prove that Macs are actually cheaper than PCs. Start from the hardware specs of a particular Mac model and configure a PC to match those exactly. It will probably be more expensive than the Mac. The thing is that nobody would choose that configuration for the PC under normal circumstances. Normally you would spec it based on your actual use case and the PC would end up both c…

I'm not sure that example is entirely true. A PC would probably still be cheaper, assuming you don't insist on getting exactly the same components and are OK with, say, substituting the Mac's RAM supplied by vendor X with an equivalent product from vendor Y (same specs).

Sorry, the point I was originally trying to make might have gotten lost in all the discussion about specific features.

It was in response to this:

>> choosing php for a new project is a no-brianer. The only other 2 stacks to which I can compare it are the Spring stack of Java or .NET core

> 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.

The way I read it, this comment claims that everything that can be done in PHP using PHP frameworks could also be done in almost any other language using one or several frameworks written in that language. In my experience, this simply isn't true. There are other frameworks in other languages that have a feature set similar/equal/maybe superior to what Symfony or Laravel offer in PHP, but those are very rare. Like "there's maybe 2 or 3 of them in existence" kind of rare. Rails, Django, maybe one or two more? It's a short list. Again, not exactly "almost every language" and all that.

Of course, any language could have frameworks offering those kinds of features, but in reality, most simply don't. For a new web project, PHP, Ruby or Python are still fine choices if you're comfortable using those languages. There's nothing wrong with using, say, Go instead. But to claim that Go (just using it as an example here, not trying to criticize Go in particular) just has one or several web frameworks lying around that can do what Laravel, Rails or Django can is simply dishonest.

Re: A look at modern PHP

#556

Earlier quoted context omitted.

Onramp is gentle... to a point. While I'm a fan of PHP for what it is, there are still plenty of footguns. Probably more than modern statically typed languages.

> Probably more than modern statically typed languages. True, but most people considering PHP probably aren't considering statically typed languages. They're probably comparing it to JavaScript, Ruby, and Python. PHP holds it's own surprisingly well in that comparison. It certainly has it's fair share of quirks, but so do the others.

Most statically typed languages have nothing close to rails/laravel nor the ecosystem surrounding them.

Re: A look at modern PHP

#557

Earlier quoted context omitted.

Define proper please.

No native support for concurrency operators, no real event loop implementation, lack built-in support for non-blocking IO... I do Elixir regularly and Actor Model is not something PHP developers know

Not being a BEAM language is not unique to PHP or it's relevant peer languages.

Re: A look at modern PHP

#558

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 *…

What do those mean? > Hashing > Encryption > CLI commands with option/argument parsing, colored output, progress bars etc. (Do you mean a management console? All of them have it.) Except for those, Django has every single one.

Hashing: Support for securely creating and verifying cryptographic hashes, like you'd need for password hashing.

Encryption: Support for securely encrypting, signing, decrypting and verifying arbitrary payloads. In Laravel, you can do:

  $plaintext = 'foobar';
  $encrypted = $encrypter->encrypt($plaintext); // this will  encrypt the plain text, generate a MAC and combine everything into a base64 encoded payload
  $decrypted = $encrypter->decrypt($encrypted); // this will decode the payload, verify its MAC and decrypt it, giving you back the original plain text
  $decrypted === $plaintext; // true
As for CLI commands, I meant the ability to easily create your own commands. Here's [1] the relevant Laravel docs, for example. You can create commands and they will have access to all the things you can use in a HTTP context too, other than the actual HTTP stuff like the current HTTP request, because there obviously isn't one. So, for example, you could write a command that would use the ORM to perform some maintenance tasks on your database.

[1]: https://laravel.com/docs/7.x/artisan

Re: A look at modern PHP

#559

As someone who has programmed PHP professionally for 13+ years (and also JS and Python) I have never run into anyone who can place a solid argument since the PHP 7 + Laravel. -- Let me clarify, PHP is useful with context. For building web apps. Each language has its best-uses. Laravel has the strongest ecosystem and community out of any language/framework combo I've seen. I can literally setup and deploy a laravel ap…

All my projects require PHP 7.4, and it's such a joy to write the modern almost-strict typed, namespaced, and code that is often inter-operable, tested with a nice testing framework, and managed with an excellent dependency manager.

I have my reservations against Laravel though. Its excessive use of static methods is not my appetite, and its rapid release cycle gives less headroom to keep track in contrast to Symfony for example, which follows Semver strictly.

Re: A look at modern PHP

#560

As someone who has programmed PHP professionally for 13+ years (and also JS and Python) I have never run into anyone who can place a solid argument since the PHP 7 + Laravel. -- Let me clarify, PHP is useful with context. For building web apps. Each language has its best-uses. Laravel has the strongest ecosystem and community out of any language/framework combo I've seen. I can literally setup and deploy a laravel ap…

I agree to the point you're mentioning industry standard. PHP is not considered in the enterprise environment, simply for all it's flaws and it's security vulnerabilities and still has the same problems as before. Most languages don't have those problems.

PHP as a language had inherently insecure designs such as register_globals and RCE in unserialize().

When working on reviews, it's often as easy as grepping for "unserialize" and working your way from there for an easy bounty.

However, PHP has matured a lot. There is not a hint of register_globals as of now, and we have proper serializers, in addition to RCE-free improvements to original unserialize().

With native support for proper password hashing, sodium, and other improvements lately, one could argue that PHP is one of the most secure languages out there.

Post reply on HN