Live data from Hacker News

PHP in 2023

stitcher.io

181–190 of 285 posts

Re: PHP in 2023

#181

If you are thinking about building a web application, take a look at Laravel. I not a huge PHP user, but Laravel is always on the top of my list for building web applications. It's the greatest web framework to ever exists, even better than Rails IMHO. The ecosystem around Laravel is really incredible and unlike any other framework. They have libraries for every stage of a web application from taking payments all the…

Laravel is a decent web framework, that comes with batteries included and _often_ has sensible ways to override and avoid things if you don't want them.

For example, you don't need to use the ORM at all and can just use their query builder (which is pretty good). It's there if you want it, but the framework works happily without it and doesn't get in your way in that regard.

I inherited a Laravel codebase from a previous contractor and it was reasonably ergonomic to navigate and extend, because I was able to lean on the framework documentation to understand how it all worked. But there were several points where it was _not_ reasonable, because of Laravel/PHP magic and those were pretty painful to figure out and debug.

The reason I wouldn't choose it myself anymore is the magic, the little surprises and hard to debug idiosyncrasies that it provides in order to look pretty. Also generally Laravel, PHP and related ecosystems are moving too fast and are difficult to keep up to date without breaking and/or misunderstanding things. It's not quite JS/npm level of churn, but unnecessary regardless. A more minor point is the baseline performance tends to be on the lower end of what I need.

There are ecosystems out there that value stability and clarity more and provide better tools to test and debug the code if necessary, and I've come to appreciate those things much more with experience than other factors such as reducing the initial development time.

Re: PHP in 2023

#182

Earlier quoted context omitted.

Does your DB have a classic design? You can very easily map an existing DB with a fresh Laravel install, just write a couple Models, their relationships and you're almost set. I have been working with Laravel on a daily basis since 6 years and have never felt more efficient with code.

Not sure what you mean by classic, but I designed it manually to be queried with plain SQL. So I suspect the answer to your question is yes. Thanks for the info!

By classic I mean something somewhat standardized like user table: id, name, email ; post table: id, user_id, content etc.

Re: PHP in 2023

#183
post #24
post #3

used php in 2015, decided that it's not that nice. last couple of months, I've been banging my head with php7. granted, it's a legacy project, but it is still the same php 7-8 years ago.

if its a legacy project then of course it would be the same php from 7-8 years ago, what exactly were you expecting? if you want to try modern php then start fresh or put in the work updating the legacy. its no different than being given a jquery project from 7-8 years ago and expecting a modern experience

"what exactly were you expecting?"

Exactly my thoughts. In the end it gets up to the developers are to blame by not taking time to upgrade their projects and end up with a legacy project.

PHP does the deprecation and backward compatibility better than many languages (hello Python!) but still some effort is needed as a developer to ensure your codebase is updated. I'm not even talking about the architecture here, which of course is harder to change, but language features.

And there is Rector to automate most of that!

Re: PHP in 2023

#184
post #49

Earlier quoted context omitted.

It’s funny because when I think of “fractal of bad design”, Javascript is the first thing that comes to mind. I love Javascript but it makes me ask “why?” a lot.

Php's inconsistencies in regards to needle vs haystack make me weep. Javascript doesn't have anything remotely like that.

JavaScript absolutely has things like that. Very famously so. https://www.youtube.com/watch?v=et8xNAc2ic8

Re: PHP in 2023

#185

If you are thinking about building a web application, take a look at Laravel. I not a huge PHP user, but Laravel is always on the top of my list for building web applications. It's the greatest web framework to ever exists, even better than Rails IMHO. The ecosystem around Laravel is really incredible and unlike any other framework. They have libraries for every stage of a web application from taking payments all the…

> even better than Rails IMHO.

I don't know about that. I have been looking at Rails 7 and there's a lot things in Rails now I like better than Laravel.

Symfony did most of the heavy lifting with getting PHP relevant again, Laravel was just better at marketing. Laravel is good, don't get me wrong but everyone seems to think Laravel is the only good thing in PHP and a lot of Laravel is built with Symfony libraries.

Re: PHP in 2023

#186
I agree with the author about the superset, this is how it should be done. The current PHP type system has many weaknesses (e.g. generics, typed collections, etc.) that aren't easily solved, and I don't want to use some static analysis tool that relies on comments to type my code properly.

Re: PHP in 2023

#187

I started my career with PHP. Created my own apps, created client websites etc. Full of footguns, but I didn't know any better. Once I learned more languages, I never used PHP again. I actually started to feel like I'd been fooled into using PHP. Now the small PHP community keeps trying to justify their language choice with articles like these and comments like the ones on this submission. They claim it's a no braine…

PHP devs hate to admit that the only reason PHP is still relevant at all today is because of WordPress.

If WordPress moved to a modern language tomorrow, PHP would cease to exist afterwards.

Re: PHP in 2023

#188
I work in PHP each day. I prefer the Yii2 framework and sometimes use Symfony. For some reason I just can't get into Laravel. I tried but the rapid development speed of Yii2 really is the best for my workflow.

Re: PHP in 2023

#189
post #159

Earlier quoted context omitted.

Laravel is great if you just want to get something simple done as fast as possible with the simplest, most elegant (at a glance) code possible and don't care at all about understanding how it works, what's going on under the hood, performance, doing anything the devs didn't expect, etc. Everything in Laravel is as obscured, "magical" and opinionated as possible for the sake of making the code "beautiful" (again, at a…

Can you give me a few real life examples where you got bit by the "magic" conventions or ran into any serious issue from not explicitly setting properties on your models? Facades are not global glorified variables with magic methods. Usually they're just a way to instantiate and access a class with less code. People complain that facades limit testability. In fact, they're easily mocked. Etc. The docs do a very good…

> Can you give me a few real life examples where you got bit by the "magic" conventions or ran into any serious issue from not explicitly setting properties on your models?

I shouldn't need "real life examples" to explain why using objects with magic dynamic properties instead of declaring the properties on the class is stupid. If I can't look at a model class and know what properties and methods it has, why is it even a class? With all the improvements made to PHP in the past decade, it feels like going back to the days when I was just using associative arrays to represent database objects.

> Have you worked with Laravel in practice?

Yes, I tried using it, was immediately put off by the issues I've described, then tried Symfony and never looked back. For every piece of dumb nonsensical magic Laravel does, you can look at Symfony to see how it should be done properly.

Re: PHP in 2023

#190
post #92

Earlier quoted context omitted.

That's such a strange statement, you can compare PHP and React because they both can return a HTML string? Even though one is built entirely within another language, and it isn't is not a "language". More of a toolkit. Same as say Symfony html framework is.

This is why I stopped posting on the internet people will twist and turn stuff for reasons beyond me. It’s like pulling teeth.

A "React vs PHP" Google search turns up tons of articles and forum questions with that exact same comparison.

So either it's logical to compare the two, or the internet is just full of idiots like me and the parent poster :D.

Post reply on HN