Live data from Hacker News

PHP 8.1.0

php.net

51–60 of 286 posts

Re: PHP 8.1.0

#51
post #24

Earlier quoted context omitted.

Phabricator is not written in "modern PHP", so your experience is not surprising

Can you link something written in modern PHP?

like the sibling comment said, web apps are written in Symfony/Laravel, but the framework abstractions with web apps might not paint you a clear picture of how the core language has improved. it will give you a good idea what it's like to build applications.

my favorite part of modern PHP is how nice writing libraries is. so it might not be what you're looking for, but I remember being pretty impressed with the code quality of the Amp PHP library recently. the v3 branch is 8.x only and (I believe) is targeting the Fibers feature just introduced in 8.1

https://github.com/amphp/amp/tree/v3

one of the best things to come with PHP are the community standardizations around things like interfaces for HTTP requests, logging, DI containers, and even code style standards. it makes for a very consistent experience when developing (at least when you're in the "new world"), since most newer libraries are all written in a similar style using common interfaces

Re: PHP 8.1.0

#52

Earlier quoted context omitted.

I've used PHP recently to work on Phabricator, and the whole "yes it sucked but now it's good" narrative did not match my experience at all. Sure it might have added modern features but the core is still rotten. The alternative would have to be TCL levels of bad to make me choose PHP.

Phabricator, much like WordPress, kind of lives in its own world and hasn't adopted most aspects of modern PHP. Even as someone who works with PHP and enjoys it, I wouldn't want to use Phabricator.

Wordpress has taken great strides to comply with the latest PHP standards so I'd say that's not quite fair to include it here.

Re: PHP 8.1.0

#53
post #37

Earlier quoted context omitted.

I've worked on _many_ PHP projects. Unless it's a small single-purpose script, if you tell me it doesn't use one of the standard frameworks, I'm going to assume it's an absolute unholy mess of spaghetti. Laravel and Symfony are both extremely good, and the only reason people don't use them tends to be out of misplaced arrogance. Unsurprisingly, they end up building their own awful framework, and at some point the pro…

I have seen plenty of PHP projects without any frameworks used. Big ones as well. One of these projects is automation for a complete manufacturer factory. Robot controllers, Serial hardware drivers written in PHP, Realtime application with PHP instances running for multiple years. No frameworks used at all. There is more than only webapps.

I’m sceptical that’s a large proportion of PHP projects, and thus comes under my caveat of _some_ projects.

Re: PHP 8.1.0

#54
post #19

Who is still using PHP anno 2021?

Rosaly.com (shameless plug) , the team of developer is 32 years old average, though we all come from different background and all used python/go/java/rust in some of our previous jobs or on our own opensource projects, we just want to get shit done.

  * it has its quirks but we know them and each newer version fix more of them.
  * its damn fast (more than python or ruby)
  * its type system is better than python (trait/interface , union type 
and as a result it tends to attract people with the same mentality, my experience with recruiting php developer is that you have a much clearer clivage of "wordpress website maintainer" and "people who want to get shit done"

you will not find for example "genius developer, that write code faster than you think, who writes all his project in rust but is now thinking to switch to haskell and will leave your company as soon as it find a company that use it"

Re: PHP 8.1.0

#55
post #18

Everyone laughing at PHP hasn't tried it for years, I'd bet. It started clumsy, true, but it became a solid and quite elegant way of doing things. And by things I don't mean just web development. The current limitations I see in PHP is that there is not an official multi-core coroutines solution.

"Everyone laughing at PHP hasn't tried it for years, I'd bet."

God I wish that was true...

It's not that the language is necessarrily bad. It's the sludge of legacy code I've had to deal with and teams treating it as the hammer for every problem that they think they must treat as a nail.

Efficency be damned.

Re: PHP 8.1.0

#56
post #37

Earlier quoted context omitted.

PHP at its core is the best part. A whole bunch of optimized and well tested C functions that are typical of backend functionality. If you can do as little as possible in PHP and rely on the low level functions to stitch together what you need, deserialize and render data in the front end, use front-end templating, then PHP is insanely fast, practical language. The issues with PHP are usually when people build out gi…

I've worked on _many_ PHP projects. Unless it's a small single-purpose script, if you tell me it doesn't use one of the standard frameworks, I'm going to assume it's an absolute unholy mess of spaghetti. Laravel and Symfony are both extremely good, and the only reason people don't use them tends to be out of misplaced arrogance. Unsurprisingly, they end up building their own awful framework, and at some point the pro…

To be honest, I quite like modern PHP. On the other hand, I tend to stay away from it, exactly because of the big prevalence of spaghetti code projects.

There just is so much legacy in the PHP world that separating the wheat from the chaff in itself becomes tedious. And don't understand me wrong: legacy in itself is not a problem. It's the combination of PHP being easy to pick up, lots of outsourcing, people writing procedural code without any notion of code readability, lack of tests, use of global state, etc that usually just make me cry and move on. For me the percentage of worthwhile PHP projects to chase is too low in comparison with many other technologies.

Even though PHP was what got me into programming in the first place, I nowadays thus chose to pick other battles. But every once in a while I still nostalgiously float back in time to my childhood days, enjoying every line of the almighty 4MB imagemagick monstrosity scripts I conspired. And then I'm happy that you nor I have to solve these enigma puzzles.

Re: PHP 8.1.0

#57
Fibers!!! Who wants to bet we are a few releases away from async/await syntax now. Giving credit where it’s due Microsoft with C# pioneered the syntax and every classic (including a few modern) language has adopted the syntax.

I believe we are a few steps away from a fully builtin production ready server and db connection support.

Re: PHP 8.1.0

#58

Still holding the web. Happy to see it is continually evolving.

What's your estimate for PHP's long-term viability? I'm asking, because it was the hobbyists and kids who got started in PHP mucking around in their everyday white-label cPanel/Plesk-based web-hosting accounts in the very early 2000s that really gave PHP the mindshare of enthusiastic users and thus its staying power. But it's 2021 now: all the kids are getting started with NodeJS for server-side web-applications, not…

There's also Moodle which got extremely more important because of the pandemic. Nothing that ever becomes as popular as PHP and continues evolving for 2+ decades disappears quickly. I think 10+15 years... I don't know... I think it will last longer. COBOL and FORTRAN are still alive, there was more heavy money into both but there are more minds in PHP.

Re: PHP 8.1.0

#59
post #37

Earlier quoted context omitted.

I've worked on _many_ PHP projects. Unless it's a small single-purpose script, if you tell me it doesn't use one of the standard frameworks, I'm going to assume it's an absolute unholy mess of spaghetti. Laravel and Symfony are both extremely good, and the only reason people don't use them tends to be out of misplaced arrogance. Unsurprisingly, they end up building their own awful framework, and at some point the pro…

To be honest, I quite like modern PHP. On the other hand, I tend to stay away from it, exactly because of the big prevalence of spaghetti code projects. There just is so much legacy in the PHP world that separating the wheat from the chaff in itself becomes tedious. And don't understand me wrong: legacy in itself is not a problem. It's the combination of PHP being easy to pick up, lots of outsourcing, people writing…

I started with Ruby, and I imagine my code there was just as bad. But I totally agree about the prevalence of bad PHP projects. My theory is that it’s the dominant language and so there are just more projects, and (like the opposite of survivorship bias) shit codebases are often looking for good developers to save them which is why you see so many of them.

Re: PHP 8.1.0

#60
post #18

Everyone laughing at PHP hasn't tried it for years, I'd bet. It started clumsy, true, but it became a solid and quite elegant way of doing things. And by things I don't mean just web development. The current limitations I see in PHP is that there is not an official multi-core coroutines solution.

One comment I heard at a programming meetup recently was "I hate how frameworks like laravel have brought PHP back in to popularity when we had the chance to finally kill it off".

I do wonder if there really was value in salvaging PHP when we have a wealth of other languages and frameworks that do a perfectly fine job without any of the legacy mistakes sitting around.

Post reply on HN