Live data from Hacker News

PHP – The Right Way

phptherightway.com

131–140 of 349 posts

Re: PHP – The Right Way

#131
post #94
post #88

Earlier quoted context omitted.

Why do you presume this is "hearsay PHP hatred"? I (not parent) have PHP hatred. It is fuelled by decades of PHP development and -exposure. My hatred is based on failing projects, missed deadlines, burnouts, money stolen, severe downtime, and companies going bankrupt. PHP had a role (not the primary, mind you!) in all of them.

It had a role because PHP is the most used web technology in the world.

No. In each and every of these cases the design of the language, the quality of community-code (libs) or the quality of the language was the cause.

I'll admit that in all cases, the humans involved where the actual root cause, but that is silly, because it always is. What PHP lacked in all these cases, was guidance, support or limitations to direct these humans to better architecture, or guide them away from bad decisions.

I'm not disliking PHP for silly designs inconsistencies, or hard-to-deprecate insecure functions. I'm disliking it for how it has taught generations of developers to not care about quality, to avoid software design and architecture, to work around hacks, to ignore failing tests, to "it's not a bug, its documented", etc.

To take a more famous, public example: MtGox, the primary Bitcoin Exchange, was hacked, BTC crashed, millions were stolen. Because adversaries breached a poorly written PHP backend service. Yes. MtGox was a bitcoin exchange moving millions a day, written in mostly PHP.

Re: PHP – The Right Way

#132
post #5

But what's the point? The beauty of perl scripts, and later php templates, was in their BASIC-like simplicity. They were not secure or structured in any way, but very accessible. Once you add these frameworks, you realize you could have started with Python or Java in the first place and get more mature infrastructure and better language along the way.

> more mature infrastructure and better language What does this mean?

PHP is a conceptually awful language. It is created by language amateurs and it shows in many early decisions such as the multiple thousands of built-in functions already mentioned.

It had its benefits since those amateurs understood their use case and their users' capacity very well. But now all of that is gone and they are still stuck with a subpar language at the core.

Re: PHP – The Right Way

#133

The reason why people now care about PHP is that, decades ago they thought PHP would the right way to develop projects, now they are stuck, because they cannot get rid of PHP any more. If you look at any well grounded projects, they try to avoid PHP at all cost. Only handful amount people are responsible for core development. Decision are made based on "copying" other languages like Java, plus you always end up using…

A poor developer can make any tool look bad.

Re: PHP – The Right Way

#134
post #88

Earlier quoted context omitted.

Why do you presume this is "hearsay PHP hatred"? I (not parent) have PHP hatred. It is fuelled by decades of PHP development and -exposure. My hatred is based on failing projects, missed deadlines, burnouts, money stolen, severe downtime, and companies going bankrupt. PHP had a role (not the primary, mind you!) in all of them.

How do you feel about php7+ ? There were some serious changes.

I haven't worked with recent PHP versions, other than through WordPress, which, if I understand correctly, does PHP a big disservice.

My last serious encounter was when I build and scaled a WordPress hosting company 5+ years ago. Which meant all my exposure to PHP was WordPress, which meant I wanted to avoid it as much as possible.

Re: PHP – The Right Way

#135
PHP is a language with various features that might make it attractive to certain people:

• CGI-like execution model when used for the web, making resource leaks very difficult and encouraging scalable design

• not only integers and floats, but also strings, lists and dictionaries as mutable value types (copy-on-write) — this is a big difference from JavaScript and Python

• unusually for a dynamic “scripting” language: true classes and interfaces, and optional type declarations enforced by the runtime

• a standard library that doesn't require import statements!

• (a very new feature:) fibers, a way do asynchronous execution without every function in the callstack having to be aware of it

• binary-safe strings without presumptions from the language about what encoding is in use

• a very nice package manager

• a highly optimised runtime

But its history has made it a quite messy language which can be frustrating to learn, and which will always carry a higher mental burden than something like Python. It is a shame.

Re: PHP – The Right Way

#136
post #126

Earlier quoted context omitted.

> I haven't for example seen many things that can honestly compete with WordPress. I'm sorry? Compete on what parameters? Almost all frameworks win, hands down, in developer-friendlyness from WordPress. Many, if not most, modern CMSes can easily compete on security or performance. Many CMSes will win in user-friendlyness - for distinct use-case even more so. Many web-frameworks win easily in versatility: there's no w…

The fact you're talking about building a payment service provider in a CMS kind of tells me this isn't a conversation worth continuing.

Sorry for not being more clear.

I was saying this exact thing: WordPress is just a CMS, which severely limits what you can sanely do with it. You won't build a PSP in a CMS. That was my point.

Re: PHP – The Right Way

#137
post #88
post #77

Earlier quoted context omitted.

Quoted post unavailable.

Why do you presume this is "hearsay PHP hatred"? I (not parent) have PHP hatred. It is fuelled by decades of PHP development and -exposure. My hatred is based on failing projects, missed deadlines, burnouts, money stolen, severe downtime, and companies going bankrupt. PHP had a role (not the primary, mind you!) in all of them.

It looks like your projects employed PHP poorly. PHP has been great for my company and my developers. We have never had to face such grave consequences because of it, and we've employed it in companies generating millions of $ of revenue.

I will pick it over any other interpreted language.

Re: PHP – The Right Way

#139
post #113

Earlier quoted context omitted.

I don't know that many nicer tools than Laravel, to be fair. Especially Laravel + Lighthouse, which is an extraordinarily neat GraphQL layer considering the huge deployability you get with PHP. PHP is progressing towards a nicer language in a way that JavaScript, IMO, is not. And taking tens of millions of programmers with it.

You should also have a look to api-platform ( https://api-platform.com/ ), it's based on Symfony and you can create Rest or GraphQL APIs with ease.

That does look interesting.

I'm currently using Nuxt/Vue (static) on the front end, with Apollo (this latter bit I will probably swap out).

What is nice about Lighthouse is that it is schema-first. I am far less fond of the "auto schema" approach that e.g. WP-GraphQL uses. (Though WP-GraphQL is not bad; I'm also using that in a project).

Re: PHP – The Right Way

#140
post #107

Earlier quoted context omitted.

> That has always been the goal of PHP, to be a web framework in itself This is untrue. PHP was a templating language and form-handler first and foremost[1]. It took a long time for it to move out of that (I'd argue up to 5.6) and become an actual programming language rather than a template language on steroids. Edit: we still have to move out of template mode in every file by adding a So, essentially, we now have we…

We're saying the same thing :) Templating language (for the web) and handle forms (on the web) makes PHP a web-language first and foremost. That's also the impression I get from reading the following section from the Wikipedia page you linked: > PHP development began in 1994 when Rasmus Lerdorf wrote several Common Gateway Interface (CGI) programs in C,[16][17] which he used to maintain his personal homepage. He exte…

I think I focused too much on the word framework, which is a vague word, and probably means a lot of different things depending on perspective.

My reply was more to explain why I think it is not a framework, but rather a language, to handle web-stuff. But looking at it from other perspectives, that can be "framework" just fine.

Post reply on HN