Live data from Hacker News

A look at modern PHP

lwn.net

561–570 of 610 posts

Re: A look at modern PHP

#561

Earlier quoted context omitted.

At least one of those front-end frameworks doesn't "mix code with templates", it represents HTML as code . (It's for that reason that JSX is the first way-to-splat-HTML-out that hasn't made my skin crawl in...pretty much ever.)

JSX just reverses the story, it's js with islands of html tags thrown in it instead of being html with code in it... in the end when you look at an average presentation component it's still like 90% html tags and some js mixed all together...

JSX is not, and I mean this emphatically not, "HTML tags". They're a tree of objects. That they sometimes represent HTML is orthogonal to why it's fantastic.

To elide all of the power and powerformance that JSX provides in the situations where it's appropriate as just "HTML tags" fundamentally misunderstands what they are and why they are powerful.

Data structures are more than text. This is a good thing.

Re: A look at modern PHP

#562
post #257
post #209

Earlier quoted context omitted.

The only issue of that I still encounter is hosters misconfiguring the php.ini, rarely. There is no shell accessible on these servers, it's on the project to include all dependencies. Composer in this world is strictly not for users, but only for developers. That's a good thing.

Oh how I hated the fact that php.ini could change so much of the PHP behaviour... can't say I miss those days. Also, I don't know about now because I left this ecosystem long ago, but it was very common for apps to bundle their own custom installer scripts (access a webpage, fill a form and so on). Certainly useful for the users but it was never standard and required a lot of work for the developers (and came with th…

This is changing now. There are no new php.ini changes that would affect how the parser or VM works. The lessons from things like safe_mode and register_globals are learned so well.

Re: A look at modern PHP

#563
post #95

Earlier quoted context omitted.

I'll concede that PHP focused hosting solutions such as your traditional shared webpage hosting environment is better at hosting PHP than any other language, and sure there are less services out there that lets you deploy code "as easy as PHP". I had to check and I'm paying about 4$ a month for a traditional PHP server host vs 5$ for a VPS which I can run whatever I want on. And if you want a barebones deployment for…

Unless you are running continuous load, the $4 PHP shared hoster is probably more powerful than $5 VPS. I know some shared PHP host that cost $8/year and have larger memory_limit than the available RAM in $5 VPS.

memory_limit is the upper bound you "allow" PHP to allocate. You can allocate more than the available RAM, and have your OS swap or PHP crash.

Pretty much every shared host I had to work with (I've been freelancing for a few years), have been terrible, except for two platforms, both of them were expensive and aimed at particular PHP software.

Re: A look at modern PHP

#564
post #112

The amount of misinformation, false claims and unsupported statements in this thread is mindblowing for the quality that I've been used to see on HN. Here are some facts: - Symfony was the backend framework with the most contributors in 2019 [1] (yes, out of any backend framework written in any language) - PHP has more active contributors than it ever had [2] - Laravel is one of the most used frameworks in the world…

> The only other 2 stacks to which I can compare it are the Spring stack of Java or .NET core Why not Django or Rails?

I've worked a lot with PHP and Java (Spring MVC & Spring Boot), and have made a few personal projects with Django. It's nowhere near as easy to get running and secure for a production environment, mainly because you have to deal with the WSGI server. There are tons of options (gunicorn, uWSGI, CherryPy, mod_wsgi if you want to go that route, etc...) and you're likely developing locally using a test server that's not suited for prod like werkzeug.

PHP runs right out of the box. As long as apache is running and you have an index.php file in your www directory, it just runs. Spring Boot is a pleasure to deploy as well with embedded tomcat, it's possibly even simpler than PHP for local development because you can just give a jar to someone and it works no differently than it would in production.

Re: A look at modern PHP

#565
post #284
post #283

Earlier quoted context omitted.

"PHP only exists today because of legacies being maintained" I think, the reason is, Facebook poured a load of money/time into PHP. Otherwise it would probably on life-support right now.

FB poured a ton of money into Hack/HHVM. Which didn't directly benefit PHP. I do see that it inspired the PHP team to improve, but that's indirect.

> FB poured a ton of money into Hack/HHVM. Which didn't directly benefit PHP

Facebook may not have directly funded PHP, but I know for sure at least one of the HHVM/Hack devs (Sara Golemon)is also a huge contributor to the PHP core.

https://www.youtube.com/watch?v=TOveFBc9AyI

https://voicesoftheelephpant.com/2019/07/16/interview-with-s...

Re: A look at modern PHP

#566

Earlier quoted context omitted.

Funny, I remember everyone hating on PHP when they moved to RoR, and now they hate that are and moving on. Its almost as if they just need things to hate so they can rewrite code. its very cyclical IMO. The elitism of learning a new language and then mocking those that haven't put in the same time and effort to row in the exact same direction, has always amused me. Ive never judged anyone for what tools they use to g…

I've been (re-)learning Rails now that it's at version 6 instead of... 2.x, I think, when I last tried it? I've been joking that now that Rails is no longer cool, it means the people left are probably settling down to do serious work. While I think you're right about the elitism hype cycle, I do think Rails and PHP have something in common, though -- they were systems that people who really weren't that interested in…

They both try to lower the bar for a person to become a productive web developer. Dhh (Rails creator) calls it "conceptual compression". But in reality, to build anything half mature you not only have to know how to program, you also have to understand the concepts Rails supposedly compresses. The complexity is still there. The best example I have for this fallacy is the notion that ActiveRecord can make SQL obsolete thus make the framework easier for beginners. Dhh advocates this and it's absolute horse shit. But yes, both Rails and php are beginner friendly, that has pros and cons and comes with a reputation.

Re: A look at modern PHP

#567
post #112

The amount of misinformation, false claims and unsupported statements in this thread is mindblowing for the quality that I've been used to see on HN. Here are some facts: - Symfony was the backend framework with the most contributors in 2019 [1] (yes, out of any backend framework written in any language) - PHP has more active contributors than it ever had [2] - Laravel is one of the most used frameworks in the world…

Where to begin? - No proper connection pooling with circuit breakers. - No proper multithreading (that works in web environment) or parallelism in general. - Almost everything blocks (even `new PDO('mysql:...')` can block for whatever the execution time limit is, if there is an issue with connection or MySQL server). - Most libraries are implemented in C instead of in PHP, whereas with other languages people try to a…

Simple blocking IO and no real multithreading are features of PHP.

It's all about simplicity.

In a web app you "multithread" using the web server...

Re: A look at modern PHP

#568
post #564

Earlier quoted context omitted.

> The only other 2 stacks to which I can compare it are the Spring stack of Java or .NET core Why not Django or Rails?

I've worked a lot with PHP and Java (Spring MVC & Spring Boot), and have made a few personal projects with Django. It's nowhere near as easy to get running and secure for a production environment, mainly because you have to deal with the WSGI server. There are tons of options (gunicorn, uWSGI, CherryPy, mod_wsgi if you want to go that route, etc...) and you're likely developing locally using a test server that's not…

idk, seems like a very narrow area to get fixated on (deployment/local development)? I do think Django is less complicated than Spring. You don't have the whole dependency injection lifecycle thing to grasp which isn't easy for someone who never seen it before. Django and PHP are closer in spirit than Spring, also due to dynamic types.

Re: A look at modern PHP

#569
post #564

Earlier quoted context omitted.

I've worked a lot with PHP and Java (Spring MVC & Spring Boot), and have made a few personal projects with Django. It's nowhere near as easy to get running and secure for a production environment, mainly because you have to deal with the WSGI server. There are tons of options (gunicorn, uWSGI, CherryPy, mod_wsgi if you want to go that route, etc...) and you're likely developing locally using a test server that's not…

idk, seems like a very narrow area to get fixated on (deployment/local development)? I do think Django is less complicated than Spring. You don't have the whole dependency injection lifecycle thing to grasp which isn't easy for someone who never seen it before. Django and PHP are closer in spirit than Spring, also due to dynamic types.

I agree that Spring has a steeper learning curve than Django, but I disagree that Django is more similar to modern PHP frameworks than Spring.

Django isn't MVC, it's an entirely different architecture. Symfony framework is heavily inspired by Spring [1], and modern frameworks like Laravel heavily influenced by it and extensively use its libraries.

>You don't have the whole dependency injection lifecycle thing to grasp which isn't easy for someone who never seen it before.

Laravel's core is built on a DI container and extensively uses that throughout. Service providers [2] are a key concept to Laravel, which requires you to directly interact with the DI container.

[1] https://en.wikipedia.org/wiki/Symfony#Technical

[2] https://laravel.com/docs/7.x/providers

Re: A look at modern PHP

#570

Earlier quoted context omitted.

JSX just reverses the story, it's js with islands of html tags thrown in it instead of being html with code in it... in the end when you look at an average presentation component it's still like 90% html tags and some js mixed all together...

JSX is not, and I mean this emphatically not , "HTML tags". They're a tree of objects. That they sometimes represent HTML is orthogonal to why it's fantastic. To elide all of the power and powerformance that JSX provides in the situations where it's appropriate as just "HTML tags" fundamentally misunderstands what they are and why they are powerful. Data structures are more than text. This is a good thing .

JSX is data after compilation which means it's not as transparent or accessible programmatically in the same way hiccup is

That said I'm not sure it'd be as easy to do hiccup in pure JS because names aren't a first class data type there

Post reply on HN