Live data from Hacker News

PHP is the new JavaScript?

mux.com

61–70 of 88 posts

Re: PHP is the new JavaScript?

#63
post #39

Bit worrying that the first code example given in the blog isn't valid PHP. Strings are concatenated with the . operator, not +. https://3v4l.org/v9tFN Or in older PHP versions it would output a number (because it would cast the strings to 0).

Shows how long it has been since I've written PHP

Re: PHP is the new JavaScript?

#64
What ever happened to Hack (https://hacklang.org) the language Meta built as a superset of PHP?

Why not take an approach more similar to TypeScript?

I sometimes do wonder if many of the server side rendering approaches (or alternative Node runtimes) would be better off trying to emulate some aspects of PHP

Re: PHP is the new JavaScript?

#65

Forget the framework, forget the AI assistant. What are PHP developers like these days? Awhile back, we wrote an MVP, a proof of concept, using Wordpress. I dug around some of the plugins and themes we used, and my god , it's still garbage. Things being shipped with huge swaths of code just commented out, spaces & tabs intermixed for indentation, TODOs littering the codebase. Things that were just flat out broken . I…

> using Wordpress

Wordpress should be avoided like the plague if you care about code quality at all. It actively encourages bad code and this will never change.

PHP programmers being conditioned to write low quality code due to their experience with things like Wordpress or other legacy bespoke codebases that aren't built on top of good programming practices is a real problem, and using a modern framework alone won't solve that problem, but I think Symfony in particular deserves credit for generally trying to steer people in the right direction. If you're just starting out writing complex applications in PHP, by using Symfony with PHPStorm (and possibly other code quality tools like PHPStan and php-cs-fixer, though PHPStorm already has decent static analysis and formatting built-in), watching the SymfonyCasts tutorials and being open to learning new ideas, you will likely end up writing at least moderately decent code because almost all of your programming environment will be pushing you in that direction.

Of course, if you just hired a straight up incompetent developer, they will likely end up writing unmaintainable spaghetti no matter how much they're pushed in the right direction, and there's definitely a high risk of that when hiring PHP developers, but I feel like there's an equally high risk for any popular high level language nowadays. Especially Javascript, there seem to be tons of self-proclaimed "front-end developers" out there who literally only know how to copy-paste React code and don't actually know much Javascript or CSS at all.

Re: PHP is the new JavaScript?

#66

Earlier quoted context omitted.

Laravel is really not great for some use cases, while with Symfony you have the flexibility of doing the things the way you want. For example, in Laravel you have the dependencies sprinkled all around the app and with Eloquent you kind of need to use active-record. I am not a big fan of Laravel but I think it is a great tool to build websites, not sure about data heavy backends.

Ha, this reminds me of a time I was proposing our team use Symfony rather than Laravel for a new project. It was such a battle. Eventually I wrote up a document (I must have spent 20 hours on that thing) showing the pros and cons according to our needs and what each options offered. The gist of it was that Laravel was a nice wrapper over Symfony components at the time (though it did offer more as well, too - it just…

Laravel hasn't changed much. I mean, it did, PHP also changed a lot in the last years but the whole idea behind the framework is the same. Full of features, easy to set up, many tools built around Laravel to deploy your app, to build your own SaaS, etc but it's highly opinionated, you have to do it their way.

Symfony on the other hand takes more work but it's more flexible. One of internal apps is made with Symfony and after working on it for a couple years, if I had to set up the whole thing again I wouldn't know how.

Re: PHP is the new JavaScript?

#67
post #64

What ever happened to Hack ( https://hacklang.org ) the language Meta built as a superset of PHP? Why not take an approach more similar to TypeScript? I sometimes do wonder if many of the server side rendering approaches (or alternative Node runtimes) would be better off trying to emulate some aspects of PHP

What would you want from typescript?

Re: PHP is the new JavaScript?

#69
post #18

I don't understand this post; the author is just shilling Laravel; the entire post is an advert for Laravel with a clickbait title. The content of the article is describing the concept of a full stack framework, as if Laravel is the novel solution to it. How in god's name is this tripe upvoted on HN?

Yes, the title does not make any sense, after reading this advert for Laravel.
Post reply on HN