DEV Community

Discussion on: Is PHP relevant?

essiccf37 profile image
essic • Edited on

PHP like JS is popular. No question about the fact that you can do great things in PHP and that great things have been done with it.
I appreciate all bootstrapping courses that teach programming.

That being said, your post does not demonstrate anything.

Saying “But when written properly, following methodologies such as DRY, SOLID and MVC” is not a valid point. Simply because :

  • Those patterns have no formal methods of verification.
  • You also can’t test that those patterns are respected in your app.
  • You can write “proper” assembly code to run on the server. The fact that it’s “proper” does not matter because you have to understand your assembly, processors... AND the web, in order to maintain the codebase and do evolution on it. I’ll take bad PHP code to maintain over “proper” assembly code anyday, simply for the fact that you can maintain it by knowing less that you would have to otherwise (whithout taking into account, more technical issues linked to the specific problem that you're solving). My point Is that writting something “properly” helps you to maintain and evolve it over time, but it will never solve fundamentals issues of your language (or stack), for all its qualities PHP requires to know its quirks and there are legion. Also "properly" is not verifiable.

PHP is fast fo pick up, has a model that fits fine with the HTTP protocols ( stateless request / response), can be run everywhere, have great frameworks and a great community. I think that to begin with PHP is not a bad choice, especially if you aim at being operational fast.

However PHP7 does not fix PHP, it helps but it does nor fix it. Yes it is broken :
In the space of distributed application, PHP lacks maturity compared to Java (jvm rocks) by example, in the space of concurrency and parallism, there are also better choice. I say Java but you can replace it with every single modern stack for the web (Elixir, .Net...)

In short, yes PHP is not dead.
Statistics don’t say that it’s a good, just that it’s STILL there, like Cobol.
Yes every languages have flaws but very few have flaws like PHP (where is PHP 6??) which are important to know.

It does matter for those who plan to work in challenging environments in the futur.

(Edits some mistakes, again)

guitarkat profile image

My question is if those patterns are not valid, what is a verified method? Your response did not give an apparent valid method that you are seeking as an example. I'm curious because I use MVC and design patterns as a base of understanding and translating a system. Or what do you mean by validity?

I also think every system is broken. Every framework is broken, but it does move us forward from where we were before sometimes, too.

Systems are inherently, just like humans being perfectly imperfect. :)

I liked reading your response as it was well written and gives me room for thought. Thanks!

essiccf37 profile image

Thanks for the appreciation :-)

Before replying, I just want to say once more that I find the initiative which allows someone to get a job, to be a good thing, using PHP or whatever.
My original reply was to demystify the idea of the bad press against PHP, is being done by programmers with bad practice.

I agree that every system in general, like everything humans do, have flaws. Perfection is out of this world, to keep trying is part of what makes thing better. Another part is letting things go.

We do not know, how to let go in our industry, so we often debate / rant / troll over things, over and over. I find that most of the time it comes down to the idea of: Cost vs Benefit.

I called PHP broken, because of the cost of these points:

  • PHP has deep design flaws which far overweight its good parts. You cannot get the good part without knowing about the flaws. This create cognitive charge and add a complexity which can be avoided. Part of the reason PHP6, never got out are due to this.
  • PHP as a platform does not have any clear advantages over its concurrents.
  • Complex systems in PHP, are truly hard to maintain, PHP do not scale well. Facebook demonstrated this. They know the web, they have in their staff top engineer who knows all the good practices and still they decided to rewrite the runtime of PHP amongst other thing

PHP is only relevant by its market share, which is reason enough, to being taught (imho) and use but hardly qualify the platform as relevant in itself. PHP7 brings no innovation or game changing feature whatsoever. NodeJS does for example, despite its flaws (still not my thing though), like the way it solves concurrence issue while focusing on performance.

One can argue that, PHP is still fine for small things. I do agree on that.

About MVC or Design Patterns in general, I got no issues with those. However, it’s important to remember that Design Patterns were presented with use case scenario and the cost of using them.
I found useful to read / overview original papers on those subject, you often find little details which changes your perspective. This article about MVC, is a good example, of what you can get when you dig on this:

So, in short my point was not about MVC in itself but about the fact that MVC does not guarantee good software. Saying that if I write a piece of software properly using MVC, does not mean that if MVC is used the software has been written properly, neither does it define the term “properly”.

Writing software is hard, that is why good code is rare and that is also why, tooling and the platform being used are as fundamental as using patterns / skills and understanding architecture.

Without knowing which problem is being solved, in which context / constraints, it’s better not to make a statement about any piece of code in my statement.

Thanks !

Thread Thread
develcharlie profile image

Node.js is not for everyone. It will be when the hosting companies will support it in their plans, until then the PHP shall be the most relevant server side tecnology. If you working in a big company probably node.js is a must, but if you are a onemanband I doubt that your core business is based on node.js

Thread Thread
essiccf37 profile image

I do not know of any modern hosting services which does not provides NodeJs out of the box. Even if you find some as long as you can run an installer or some package manager, you’ll get no issue installing Node.

PHP is relevant, I do not dispute this point, it is a major plaftorm use on the web. If the aim is to teach people to be operational in web development it is a good choice but not because « The language has evolved a lot over the years », (again where is PHP 6??) but only because it is a viable long term option to get a job. Also the web runs on many legacy systems or with tools like Wordpress, Mangento ... so yes, most of the web runs on PHP like most legacies in Finance running on COBOL. This only proves that systems are not easily replaced not that PHP is relevant as language, platform or anything other than getting a job in 2018.

My point is that nothing has been demonstrated in the original post.

Node is used by big and small companies. It is also used by onemanband. I do think that it is easier or as easy to pick up than PHP, no web developper can ignore Javascript, which is one of the reason it is easy to pick up.

I am not a Node fan at all but I did and would keep doing work in Node in the future if needed or pertinent to do so. For reasons stated above, I won’t work in PHP ever again.

I mainly work on medium / large project with F#, C# and sometimes Clojure so I won’t deny my biais towards heavier environments which help me scale (yes PHP won’t help you). However as stated before, I think that PHP is not a reliable platform on the long run and that Node is much more relevant for any sized modern backend developpement / websites (server side rendering).

Thread Thread
develcharlie profile image
DevelCharlie • Edited on

Really node.js requires more and more resources than php, so please go to check the limitations that the providers impose to use it on a shared. If you have a vps, dedi or you are in cloud ok. But many little firms are hosted on a shared plan. And you have to consider the tournover behind little companies that use PHP.

PHP isn't a multipourpose language and you cannot compare it with c#.

PHP has many limitations, has not consistance as we know, but we would like speak about JS?

Of course JS is mandatory in the modern web and JS isn't perfect too. It has not a solid syntax for example (if you use "else if" in JS you'll probably introduce in the code a problem, because JS has not "else if" but it runs without debug error, you can use ; or not, many newbies don't use var and produce bad code).

PHP for many years will be on the run not only for the legacy of the past but because many web developers choose frameworks like Laravel, Simphony. As you know Laravel has choosed vue.js that permits integration with others JS framework, so as you said "no web developer can ignore JS".

if you consider the websites market, PHP will be for many years the king of the server side IMHO

Thread Thread
essiccf37 profile image
essic • Edited on

I agree with on your point on Node and shared hosting plan, I admit that I am not involved with companies which uses shared plan for a long time now. Even on personal or contract work, I do not even consider shared plan as an option anymore. My mistake, thanks for the correction.

« PHP isn't a multipurpose language and you cannot compare it with c#. » That is interesting to me. There is nothing that you can build in PHP that can’t be done in C#. The reverse is false, since PHP isn’t multipurpose as you stated. However since I can build website in both, why can’t I compare both on building websites ??

JS is not a much better language than PHP, however its ecosystem makes it a modern platform for server side development. If we are talking about a website you can do it on Node but PHP has clearly the upper hand, no question about it.

I feel that I am not clear about my « problems » with the PHP platform, I try to sum it up here :

  • If we talk about server side (web services and middleware), PHP is out of the game as a modern scalable platform today. Even for small services, Node, Flask and many other blow PHP away, period.
  • If we talk about building small to mid size websites, PHP is relevant but I pray that you never have to maintain, over time, the mess that it will get into, as you grow the codebase : PHP do not scale
  • There are no languages where growing a codebase overtime is not a challenge, that’s one of the reason software is hard but PHP does not help you. Same for JS but the tooling is modern and everything transpile to JS. « Writing it properly » or use « {insert any framework / tool / technique here }» can’t change that.

So to me :
« if you consider the websites market, PHP will be for many years the king of the server side IMHO » is more like : PHP ain’t going anywhere any time soon, it is the cheapest solution to bootstrap, it’s hosted where no one else need to go and it’s perfectly fine for people to work with it (Slack for an example) but it’s not a modern solution for any kind of development for a business (small or large) also IMHO.

Also, PHP 6 was never out, there are technical issues with PHP as a platform and a language.

Thread Thread
hasnatbabur profile image
Hasnat Babur

Laravel or Symfony are the game changer here.

Thread Thread
essiccf37 profile image

My reply is 3 years old.
While some things must have changed, I stay of the exact same opinion :

  • PHP does not scale
  • It does not fit requirements of a modern backend platform
  • PHP only advantage is its reduced cost on mutualised hosting. These are not things that Lavarel or Symfony can fix, imho.