Live data from Hacker News

PHP in 2021

stitcher.io

271–280 of 309 posts

Re: PHP in 2021

#271
I no longer use PHP, but I have to say, I truly appreciate the regular articles on the state of PHP by @brendt_gd. I think they're absolutely awesome, and I wish I could get the same kind of regular rundowns for Python, for example. :)

Re: PHP in 2021

#272

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…

What's harder about deploying a Rails app? Generally interested. How does it go in Laravel land then? Rails have quite a few dependencis (Node, webpack), how is Laravel handling front end?

I'll preface this by saying I'm probably getting a little ahead of my skis. :) But, I think the issue is less how modern PHP is handling all those modern dependencies and more how "old" PHP didn't make you, the person installing the application, have to know anything about them. Those old-style apps, which include WordPress and many forum software packages, get "deployed" by

1. Downloading the application archive and uncompressing it

2. Creating a MySQL database according to the documentation

3. Either editing a small config file to give the application the database credentials, or even just going to the application's index page and filling in the details on a first run experience

And... that's it. Rails has no comparable experience, unless -- like Discourse -- you put in a lot of work to get it there.

Laravel -- and Symfony -- work basically like other "modern" frameworks do, for both good and bad. Laravel has "Mix," built on webpack, for instance. So if you're looking for that in PHP, it's there, but that's kind of a tradeoff in the context of small sites deployed/managed by a single person -- a use case that I think modern webdevs sometimes lose sight of. If we go back to the example of forums, those are very often that "one person wants to host a forum for their community" kinds of things. (And I'd like to see more of us get back to self-hosted blogs -- which is part of what led me down the road of "can you write something in a not-PHP language that's still easy for someone who doesn't know anything about web development to deploy and run." The answer still seems to be "reply hazy; ask again later.")

Re: PHP in 2021

#273
post #241

Earlier quoted context omitted.

>With PHP you have more moving parts, Apache/Nginx with their configuration and then the PHP script. With golang/rust/python/nodejs you have direct access to the webserver and more control, but the same simplicity. From my limited node experience I had to setup Nginx too and then connect it with node, and setup some manager like "pm" to keep the things running. When people say PHP is simple to setup they mean the cus…

The OP I responded to was about having a quick script up and running. Of course for a fully fledged app you might have a reverse proxy or similar. Also PM is just a simple hypervisor, it doesn't have any logic, while Apache and Nginx do.

Are you talking about the dev workflow?

My point was that I already have a cheap webhosting, with a domain and email and I can now just login into cpanel and paste a script.

As a developer as other mentioned there are ways to run stuff from CLI, so IMO PHP is pretty equal with python or ruby , not sure there is a general clear winer so it always depends on the project and the team.

But if you are a new dev and you don't know any of the languages I would say start with Python, even if I prefer the C syntax. I got into PHP indirectly, I worked on desktop applications and I was asked to help with a web project so I learned it by doing (but I was already experienced so I did know what are some good practices), in the end desktop applications are no longer popular so I am still working on SPAs

Re: PHP in 2021

#274
post #215

Earlier quoted context omitted.

> But almost no one writes php alone. Maybe hobbyists or Wordpress users. What about that one guy who made https://remoteok.io/ using a single PHP file with no frameworks or libraries? According to this live chart https://remoteok.io/open he made $88,000 last month from it alone with a 90%+ profit margin. But more importantly it's a site that technically functions well and looks appealing. End users really don't care…

I don't know what this proves. Most people who talk to a db and grow their app will go for a framework, are you disputing that fact?

It 'proves' that a lot of people, yours truly included, do not use frameworks

Re: PHP in 2021

#275
post #128

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…

PHP/Laravel is a higher level of abstraction. With Laravel specifically, it's the closest thing I've seen to writing web-app business logic directly in English. Sure, like any abstraction, it comes at a cost. Your applications would be more performant and CS-theoretically-elegant if written in C++ or Elixir/Phoenix. But you would spend a lot more time digging into segfaults, manipulating databases, and writing CRUD f…

> Your applications would be more performant and CS-theoretically-elegant if written in C++ or Elixir/Phoenix. But you would spend a lot more time digging into segfaults, manipulating databases, and writing CRUD form boilerplate, which is far removed from your business logic.

With C++, absolutely. With Elixir/Phoenix? I never have to debug low-level issues. I also don’t have to waste time debugging stupid scope stuff and dumb data structure inconsistencies that PHP is full of.

> “magic” around databases, forms, CRUD, … scheduling and task queues…

“The bill comes due…” As long as you’ve got a small scope, sure, that might work. Maintenance on magic gets harder though. If the magic is what you need, you might want to take a closer look at the Phoenix system. Ecto’s DSL is just as easy as an ORM in the simple case, but is far more composable and robust in the complex cases. For simple jobs, you can just leverage the BEAM for task scheduling—I needed a little task run every 5 minutes; all it took was a dozen lines of simple code—no Redis needed! Just as “magic” feeling, but better architected and maintainable in the long-run.

Re: PHP in 2021

#276

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…

You're right that PHP has historically had its fair share of "development by copy-and-paste from StackOverflow" developers. However, I've noticed that in recent years a lot of those people moved to the JavaScript ecosystem. It's the latest shiny and the learning curve and time-to-deploy curve is low like in PHP (though, many in the JS community are trying their best to complicate that part for reasons I can't fathom)

Does that leave a PHP community comprised of only people who adhere to solid CS/SE principles? No, but that doesn't diminish the fact that PHP still has a lot going for it. It's easy to get started. You can adhere to solid CS/SE principles with little effort if you have the discipline to do so. It's trivially easy to deploy a PHP application. The documentation is still fantastic.

Re: PHP in 2021

#277

I wish there was a nodejs equivalent to Laravel

I would say next.js comes closest for a ‘nodejs server framework’ for me. It’s really great to only use one language for frontend, backend and templating.

But to really come close to laravel I would add something like blitzjs.com or redwoodjs.com. Blitz is built on top of next and adds ORM (Prisma), code generators, even authentication out of the box, so it's really close to Laravel. Redwood is its own thing AFAIK, but also aims to be closer to a full stack framework.

Re: PHP in 2021

#280

Earlier quoted context omitted.

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

> I guess companies that use Discourse and have huge traffic can pay a bit more, nothing wrong with that. The point being that said numbers aren't big traffic, they should be handled by a Raspi. But for the sake of argument: Discourse is a painless move upwards for big budget and/or big knowledge entities. Nothing wrong with that. On the other hand Discourse isn't a replacement for low cost, decentralized, easy to de…

Well, an entirely non-profit -- at this point, in fact, unincorporated, with no assets to speak of at all -- writing group that I'm part of migrated their forum in 2019 from a PHP forum package (I think SMF, although I wouldn't swear to that) to Discourse, and it runs just fine on what I'm fairly sure is a $10/month Digital Ocean droplet.

I don't doubt that Discourse requires more resources than most PHP forum packages do, but it doesn't need that much more.

Post reply on HN