Live data from Hacker News

PHP in 2021

stitcher.io

201–210 of 309 posts

Re: PHP in 2021

#201

Earlier quoted context omitted.

Look at the abject failure of Discourse. If it had been written in PHP then it would have completely replaced all current forum software. But the devs there hate PHP and went for a modern stack which is all but impossible to install except for tech professionals. In other words, they chose a tech stack which suited them as developers, and not which suited the end users of the software. End users love PHP because you…

End users love PHP because you copy the files into a folder. That's certainly how people deployed web apps built by other people a decade ago, but these days isn't it more common to use something like Docker? Deploying a containerized app should be pretty much the same no matter what language it's written in. And Discourse does have a Docker container ( https://github.com/discourse/discourse_docker ), so I'm not sure…

I don't use shared hosting anymore (vultr or do mostly now), but I also don't generally use docker...

There's limitations and bloat involved with containers that I don't like. I'd rather just configure nginx/letsencrypt and create some bash scripts to make deployments work...

I'll often pair this with jenkins or come ci or use deployer for deployments that don't tear down the old until the new is green, and keeps a few snapshots, but personally I don't like docker much, even my dev environment uses nginx and no docker.

Re: PHP in 2021

#202
post #138
post #119

Earlier quoted context omitted.

I'd love to debate the use of PHP vs. Ruby and Elixir, but your arguments basically are: - The community is full of people who just care about hacking something together. - Ruby/Elixir are fantastic, developer friendly, and have solid foundations. The first happens with every popular scripting platform. Is JS community full of PhDs? The second is highly subjective. Ruby is problematic, because it's supported by one f…

Moving from PHP to ruby, language speed has never happened to be a subject. During coffee time banter, sure, but in real performance related issues, what we face came down to query optimizing, cache management, algorithmic issues and data pre-processing. We didn’t even hit the “let’s write this in C” moment nor debated about moving parts of the code to faster systems/libraries. I’m not saying it will never ever happe…

It's not "language speed", it's memory consumption per request that makes the biggest difference in practice.

Re: PHP in 2021

#203
post #141

Earlier quoted context omitted.

> My question is: why would anyone want to start something new with PHP in 2021? Is there anything that it does better than any other language/ecosystem? Well, on Twitter the other day, I asked, only partly tongue-in-cheek: > Even in 2021, any new server-side web app with even a vain hope of being installed by people who are tech savvy but not modern web nerds should probably still be written in PHP. True or false? T…

> I appreciate Laravel and Symfony, but PHP in 2021 has traded the feeling of being a cargo cult version of Perl for the feeling of being a cargo cult version of Java. As a Symfony dev I agree. And the process to convert PHP into a Java-esqe Kotlin-esque language is continuing. Why not use a different language if you like it rather than change PHP? > If I do write a new project in PHP, it's probably not going to be w…

> Why not use a different language if you like it rather than change PHP?

I don't disagree in principal, but I'm struggling to think of much that isn't totally optional. For example, you can still completely ignore the type system.

There have been some BC breaks lately, but it's mostly around footguns that should never have been like that in the first place.

Re: PHP in 2021

#204

Earlier quoted context omitted.

Deploying a Rails apps is, in general, harder than deploying a PHP app. I'm not convinced that Discourse is the right example here, though. Arguably the actual steps for installing Discourse aren't significantly more complicated than WordPress's install, because they've gone out of their way to make it as easy as possible. (It does suffer from "you must use Docker for this," which would likely intimidate non-techies…

> Also, I don't think Discourse can remotely be described as an abject failure, given that virtually every forum I've seen go up in the last five or six years runs on it Two thoughts and personal observations on that: 1. Nobody was ever fired for buying IBM. In my impression it's usually deployed as default for and esp. by very tech affine communities. It was the new, hot - and is now save - thing in town. 2. You see…

> how the Discourse forum is now powered by a new six core 8 GB RAM server improving performance ... for 200 concurrent active users and 80k posts.

I guess companies that use Discourse and have huge traffic can pay a bit more, nothing wrong with that.

Re: PHP in 2021

#205
post #196
post #161

Earlier quoted context omitted.

I'm sure that's the case. But as we break down the arguments that PHP sucks one by one, it's not performance, it's not libraries, it's not this, it's not that. How about this article "PHP a fractal of bad design", oh most of those no longer apply to PHP. What's left? The slightly unwieldy syntax (still C-like, so close enough), and the bad reputation driven by memes.

I didn’t touch PHP 7+ for kore than hobby projects so things might have changed, but to me PHP’s main issue (and to some extent JS) was the need for a strong defensive coding discipline. There is no specific flaw that is a roadblock, just a ton of things you know you shouldn’t do, cases you need to guard against, and base functions we effectively banned from our codebase. I still like PHP, and just moved for unrelate…

> the need for a strong defensive coding discipline.

PHP 7/8 have a lot more typings, it's still optional but you can require your code to use strict typings, and you can use a static analyzer like psalm to basically recommend best practices, add a few tests and your code is pretty damn solid and passes most "smell" tests and generally won't break often or as often as something in python, ruby, go.

Mix in swoole and you went from 200 reqs/sec to 6k which is about 2k more than elixir, so really just about every issue php ever had is basically replaced by just more "mature" architecture.

If you know advanced php, and the new features/best practices etc and use good tooling then php is an awesome language.

Re: PHP in 2021

#206

Before you call me a troll, know that I worked with PHP for two+ years maintaining both legacy codebases and writing new code with Laravel. My question is: why would anyone want to start something new with PHP in 2021? Is there anything that it does better than any other language/ecosystem? I feel like the community is full of (but not exclusively composed of—there are some gems like Caleb Porzio who write good stuff…

"If you have a hammer, every problem looks like a nail."

Both PHP and the success of Web applications are inextricably tied to each other. It's easy to pick up and easy to run. Others commenters have already expanded on these advantages.

PHP has treated the Web as a first citizen before anything else for the longest time. It sits on the crossroads of I/O over HTTP(S) and it's really good at what it does. The massive amounts PHP frameworks are testament to that.

Even so, moving away from that vantage point, the story shifts quickly. The rise of the Web doesn't just imply managing / processing HTTP(S) I/O - building a simple web interface, a simple REST/JSON API,... - it also means managing the complexity of data management. Data migrations, transformations, juggling processing jobs, tying API's together,... are the bane of many a PHP developer.

Many a PHP framework provide API's to do background processing via PHP scripts you run on the command line. There are plenty of PHP libraries out there to make things easier as well.

Thing is, languages like Go or Elixir run circles around PHP when it comes to things like concurrency, multi-threading and robustness. Python's idiomatic approach to data munging makes it more suitable then PHP to deal with complex textual as well as binary datasets.

PHP absolutely has it place for several classes of business problems. But definitely not for everything. Having spend a decade in PHP consultancy, I've witnessed several client projects suffer heavy delays or fall through because an entire business domain got shoehorned in PHP, and - worse - in specific PHP frameworks that bring their own additional layers of complex abstraction.

The latter is not a fault exclusive to PHP or developers who solely specialize in writing PHP, or even a specific PHP framework. Rather, it's caused by complex biases and social dynamics that tend to lead towards a narrow-minded tool-centric approach of complex business challenges.

Just like a hammer, PHP is a tool with a limited set of use cases. Just like any language.

Re: PHP in 2021

#207

Before you call me a troll, know that I worked with PHP for two+ years maintaining both legacy codebases and writing new code with Laravel. My question is: why would anyone want to start something new with PHP in 2021? Is there anything that it does better than any other language/ecosystem? I feel like the community is full of (but not exclusively composed of—there are some gems like Caleb Porzio who write good stuff…

> the Elixir/Phoenix stack, really developer friendly I do PHP/Symfony and Elixir/Phoenix and really it's more nuanced than that. Really if I don't need things that are suited for the BEAM/Elixir/Phoenix I'll probably be more productive with PHP/Symfony, especially for CRUD: the strict type system is better, the templating is better, the framework includes way more functionalities, the static analysis is better, PhpS…

I think if you can integrate swoole with coroutines in the right places, some benchmarks may have it faster than phoenix even... and I know laravel has had swoole packages, but recently with octane has made it more central which is good because a lot of issues were with maintaining state with requests and multiple threads as well as database changes.

Re: PHP in 2021

#208
post #121

Before you call me a troll, know that I worked with PHP for two+ years maintaining both legacy codebases and writing new code with Laravel. My question is: why would anyone want to start something new with PHP in 2021? Is there anything that it does better than any other language/ecosystem? I feel like the community is full of (but not exclusively composed of—there are some gems like Caleb Porzio who write good stuff…

I started my career in 2006 with PHP and was using it a few years before in private. I used it until 2012. After that I switched to JavaScript and never went back. First, I did frontend development, then backend with Node.js, then Mobile with React-Native. In between games and now serverless. PHP isn't bad, it became quite nice these days. But it simply isn't as flexible as JavaScript. Everything new technology that…

> But it simply isn't as flexible as JavaScript

I guess it depends how you define "flexible". The language itself is clunkier, particularly anything involving closures (although that's getting better), but it does so, so much stuff out of the box (even if the APIs are often a bit footgun-y).

Re: PHP in 2021

#209
post #134

Before you call me a troll, know that I worked with PHP for two+ years maintaining both legacy codebases and writing new code with Laravel. My question is: why would anyone want to start something new with PHP in 2021? Is there anything that it does better than any other language/ecosystem? I feel like the community is full of (but not exclusively composed of—there are some gems like Caleb Porzio who write good stuff…

"They care nothing about elegance and have but a dim conception of larger CS/SE principles." / "I really see no reason to not choose a better tool in this day and age." Every time there is a PHP news update these kind of posts come out. They claim some vague experience in PHP and then go on to list all these other wonderful languages you could be using instead and that insinuate you must be a bit of a shit developer…

Reminds me of the meme/video about mongodb: "It's webscale".

https://www.youtube.com/watch?v=b2F-DItXtZs

Re: PHP in 2021

#210
post #138

Earlier quoted context omitted.

Moving from PHP to ruby, language speed has never happened to be a subject. During coffee time banter, sure, but in real performance related issues, what we face came down to query optimizing, cache management, algorithmic issues and data pre-processing. We didn’t even hit the “let’s write this in C” moment nor debated about moving parts of the code to faster systems/libraries. I’m not saying it will never ever happe…

It's not "language speed", it's memory consumption per request that makes the biggest difference in practice.

The two are heavily correlated, though.
Post reply on HN