Live data from Hacker News

PHP in 2021

stitcher.io

291–300 of 309 posts

Re: PHP in 2021

#291
post #90

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 was recently asked to do a simple order page for a company where I know a guy. It would be a simple page with a few web forms, emailing the order to them. That's all they needed. I chose PHP because: 1. Even though I haven't used it in a while it is super simple to get in to. 2. They did not pay me to learn new stuff. They did not need a fancy web framework. They don't care about code elegance. 3. They already had…

Sounds like (3) is the only strong argument for using PHP in this case. In particular, as a developer you should care about elegance (2), and python (flask) could have solved all other points as easy had they not already been using PHP.

Re: PHP in 2021

#292

Earlier quoted context omitted.

> - Runtime errors are more common in PHP and that's a good enough reason for me to say that PHP dev workflow is worse. Seems you just know more Go than PHP, which is fine of course. No language has "more runtime errors" than other languages, just developers of varying skill-levels in that particular platform > - You also seem to miss some common errors when the PHP assets are missing. Suddenly the compile con become…

> Seems you just know more Go than PHP, which is fine of course. No language has "more runtime errors" than other languages, just developers of varying skill-levels in that particular platform A type system reduces the risk of runtime errors, because it doesn't let you write code with undefined behaviour such as indexing a null. Depending on the implementation, it can even force you to handle all possible failures ex…

Right now, PHP is only missing typed local variables. Class fields are typed, function arguments are typed, function returns are typed. And local variables can be typed for static analysis purposes with `/* @var $str string */` annotation.

I'd add generics to that list, but Go doesn't have them either, so not really a point for discussion.

Re: PHP in 2021

#293
post #156

Earlier quoted context omitted.

> You can do this with one PHP file , one a super cheap hosting , with code that is simple and clear. This. PHP is basically Functions-as-a-Service over commoditized virtual hosting. Maybe we need a toolchain that can transpile down to PHP, starting from more common languages with better development workflow.

You can also do it in one golang file. Or one python file. Or one nodejs file. 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.

> Or one nodejs file

And 98726354 packages that get pulled when you `npm i express`

Re: PHP in 2021

#294

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…

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…

I would avoid PHP and Ruby just the same, but for very different reasons.

Anyway regarding deploying, these days Go is available. It's probably the easiest one to deploy, just copy the binary to the server.

Re: PHP in 2021

#295

Earlier quoted context omitted.

idk if we're talking about ease of getting started Heroku kinda made it as easy as it can get (started with Ruby but now supports all languages).

You still need Heroku for that while there are a literal boatload of PHP shared-hosting providers.

[deleted]

Re: PHP in 2021

#296

PHP has been in a pretty good place since 7, IMO. These are some great developments. I would say that Laravel is an extremely high quality framework (on par with and even in some ways better than Rails) that nobody should be ashamed to use. It's unfortunate that the stink of old PHP is so powerful and that salaries are still lagging so far behind.

> I would say that Laravel is an extremely high quality framework I strongly disagree. My experience with Laravel made me see it as a medium quality framework with many flaws. I'll point out to a few of them. The source code quality of the framework is not very high, and locally very poor. For instance, you can't autocomplete normally with an IDE unless you load extra declarations of the magic. Sometimes functions re…

The magic is a problem in other ways as well, it confounds static analysis (Psalm has to have a separate plugin just to be able to profile it).

I'm not saying it's a fault of Laravel (yet) because the framework predates a lot of 7/8 stuff but they show absolutely no incentive towards making it better in that area.

Frankly, just pick symfony it's a better tool for longer lived projects, better documented (insanely better), better backwards compatibility.

Re: PHP in 2021

#297

Earlier quoted context omitted.

> I would say that Laravel is an extremely high quality framework (on par with and even in some ways better than Rails) that nobody should be ashamed to use. Never heard of Laravel. Decided to take a look. First thing the intro documentation says to do is install something called 'Docker Desktop'. I'm good, thanks. Why do I need Docker to play around with a web framework?

“ Never heard of Laravel. Decided to take a look. First thing the intro documentation says to do is install something called 'Docker Desktop'. I'm good, thanks. Why do I need Docker to play around with a web framework?” Because modern web development is complex, and Docker helps make that burden less so. You make it sound like you took one look at the docs, and that was just too much for you to go any further. Don’t…

OP has a valid point. What's so painful about Laravel deployment that it requires Docker? And that's just for Laravel, then you need another for your database. Then if you're working from home most broadband connections will not be suitable for containers. The whole Docker/Kubernetes cult is a farce as far as solo freelancers are concerned. Making it an idiomatic default just smacks of elitism.

Re: PHP in 2021

#298

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…

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

> endless mazes of "get a Request object from a RequestFactory

Comet to the rescue: https://github.com/gotzmann/comet

Re: PHP in 2021

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

> I used it until 2012.

That means that you've missed the train of modern PHP and frameworks completely. It's not fair to compare old school PHP with modern lang like TypeScript

Re: PHP in 2021

#300
I used to work both with Go and PHP.

At first when I started digging into Go I thought that eventually I'll replace platform for all my future PHP projects. But it never happened.

Every time I should implement business logic and info exchange with database I immediately became frustrated with so much boilerplate code of Golang. In comparison, writing such code in PHP is real breathe.

But suddenly I've got used to Go speed and want to get the same benefits for my PHP APIs. So I've implemented my own framework with low latency and hight throughput in mind. It beats many Go frameworks on TechEmpower Benchmarks! Now I feel like I found epiphany finally :)

https://github.com/gotzmann/comet

Post reply on HN