Live data from Hacker News

PHP Popularity: Is it decreasing and what to do about it?

otsch.codes

41–50 of 166 posts

Re: PHP Popularity: Is it decreasing and what to do about it?

#41
post #4

PHP popularity is decreasing because there are better tools for the same niche today. The same happened for Perl in 00s. The same is happening for every web backend language, as JavaScript is becoming ubique due to it being the de facto and only choice for the web frontend. Maybe PHP can be made better, but it would need some radical changes and then the question is that if it’s worth the effort and maybe to pick up…

What's the JS equivalent of "place an index.php file in a folder to deploy"? What's the JS FOSS equivalent of ProcessWire as a CMF + CMS? What's the JS equivalent to e.g. DreamHost and other drag + drop hosts? (Legitimately curious, and I'm mainly inquiring after equivalents-for...better-thans would definitely be interesting)

What is the PHP equivalent of writing your front end and back end in the same language so you can share libraries and data and not have to switch gears between two different languages each time you look up or down the stack?

There is a HUGE advantage to using the same language in the browser and on the server, and PHP isn't ever going to displace JavaScript in the browser. So JavaScript it is. That ship sailed a LONG time ago.

Re: PHP Popularity: Is it decreasing and what to do about it?

#42
post #4

PHP popularity is decreasing because there are better tools for the same niche today. The same happened for Perl in 00s. The same is happening for every web backend language, as JavaScript is becoming ubique due to it being the de facto and only choice for the web frontend. Maybe PHP can be made better, but it would need some radical changes and then the question is that if it’s worth the effort and maybe to pick up…

What's the JS equivalent of "place an index.php file in a folder to deploy"? What's the JS FOSS equivalent of ProcessWire as a CMF + CMS? What's the JS equivalent to e.g. DreamHost and other drag + drop hosts? (Legitimately curious, and I'm mainly inquiring after equivalents-for...better-thans would definitely be interesting)

Well "place an index.php file in a folder to deploy" is a lot of server (maybe Apache / PHP) running to support that.

Node typically IS the server. So, you could install express and have a simple web server listening on a port and serving up html or json in about 5 lines of code. Unlike PHP Node is not, in itself, a templating language. So if you want to render HTML pages you'd also need to install something like EJS, but generally node servers are just serving up JSON API, and your frontend would be some frontend framework (React, angular, vue). Although all of that is trending back the other way with NextJS the old is new again and server-side rendering is the hotness again.

Another option is to use a framework like NestJS. With that you do

    # install the nest cli (only needed for starting a new project)
    npm i -g @nestjs/cli

    # scaffolds a new project
    nest new project-name

    cd project-name

    # node server is now running on port 3000
    npm start

For easy deploy. That was kinda Heroku's thing. You just "git push" a node project and it magically knows how to deploy it, but Heroku got bought by Sales Force and murdered from my understanding. There are a lot of alternatives though. AWS, Azure, Google, CloudFlare, Digital Ocean, etc, etc all have similar offerings where you just push a node project to git and it deploys automagically.

Alternatively you can use AWS Lambda / Azure functions (or a dozen other "serverless" solutions) and you can just drop js files (functions) and they run on demand.

For a ProcessWire alternative there are a ton of options. A few I've seen are: Ghost, ButterCMS, Strapi

Re: PHP Popularity: Is it decreasing and what to do about it?

#43
Like any programming language, encourage others to produce their own rather then just dumping "Use Symphony" "Use Flask" "Use Angler" "Use React".

This goes for all programming langs, the approach of "I know, lets use xFramework!" is flawed -- you end up with a generic X-lang website which caps your creativity because your locked in to using a framework based upon decisions of the developer. You add your stuff to it, dev updates the framework and you find out your stuff is broken because of some change. Frameworks restrict.

If people started to code their own like back in the day of PHPNuke, PHPCms, e107, PHPBB.. -- these languages wouldn't die. Not to add that the ecosystems of these frameworks are so fragile you end up with a convoluted mess where your stuck with the paradigm of the framework rather than your own design. This adds more further complication where your forced to abandon later on in the game or continue to be sucker punched because you want Z function, which won't be pushed in to the framework. You then create your own Z function but this adds overhead because any future update to the framework has potential of breaking your own function.

I'm an advocate to stop using frameworks. As a black smith does in making a hammer to smeld a tool to create an object. All takes time and effort, skills to develop. But when you do, the satisifaction is so worth it. Creating nothing is something; then from nothing creating something is an amazing feel. The wisdom, knowledge, hackery is far and beyond, you grow as a person. You end making something unique, something that no-one has ever made before. You have your own product.

Using a framework is skipping that step and using what someone else has created rather then your own.

Yes, controversial, you should be reinventing the wheel. Because if your not, your stuck with a pre-defined wheel where you are forced down a path of restrictions. Granted exceptions can be made if it's for corporate bandwagon but where's the individually of coding gone?

Re: PHP Popularity: Is it decreasing and what to do about it?

#44
post #28

Earlier quoted context omitted.

What's the JS equivalent of "place an index.php file in a folder to deploy"? What's the JS FOSS equivalent of ProcessWire as a CMF + CMS? What's the JS equivalent to e.g. DreamHost and other drag + drop hosts? (Legitimately curious, and I'm mainly inquiring after equivalents-for...better-thans would definitely be interesting)

People always seem to come up with the argument that you can drop an index.php in a folder and be done with it. Only nobody uses php that way since decades. Modern php code uses Frameworks, Package mangers, opcode caching, and application servers. It’s just that other languages don’t carry all the cruft php has in its heritage…

The drop index.php into a folder is the only way I use PHP now.

Back when I was building applications in PHP it was all frameworks. package managers, op code caching, etc. But I no longer do PHP development but for my own personal websites I still use PHP but in that most minimal form.

Re: PHP Popularity: Is it decreasing and what to do about it?

#45

Earlier quoted context omitted.

Java is very much in ascendence.

Even if there weren't any technical reasons not to use Java or better alternatives, the elephant (or lawnmower) in the room is Oracle.

C# is pretty good, but Visual Studio dependence is a crutch.

Re: PHP Popularity: Is it decreasing and what to do about it?

#46
Some folks will never come to it, some folks will stick with it (like me).

Language is language. The value prop for most orgs using tech is the ecosystem. The PHP ecosystem is large, and has a lot of good quality stuff available. Building on laravel or symfony, or using products and services built around those, can be a big advantage over some other tech.

There are always examples and counter-examples, and usually a decision will come down to "you should use what a team is already skilled in". That's the pragmatic answer. You have a team of .net folks... don't jump to express or flask or laravel because of some benchmark or neat article or resume-driven-development. Stay in the .net world, and use what you know. That has to be balanced with "what you know may go away, so be ready to learn new things". Maintaining a balance, both for yourself, as well as the tech in your organizations, is something to regularly be aware of.

I love PHP. I like web stuff overall. Over the last... 30 years of software dev, what I've noticed is that the really useful/good ideas tend to get implemented in various languages if they're useful. The sign of a useful library can often be that there's multiple implementations of it. We saw a productized "web mvc" launch rails, and we then saw a dozen variations in other languages take the essential parts, implement them, and good ideas have flown between various tech camps for years since.

There are counterpoints to that. A colleague is doing some work in SciPy, and there doesn't seem to be an equivalent outside python. In PHP, we have FlySystem, and I've not yet seen an equivalent outside PHP. I've seen some attempts, but they tend to have one or two adapters, and that's it.

Overall, language diffs are often/mostly personal preferences. Your project or business isn't failing because your language of choice can't connect to a database quickly enough, or that you can't write data to filesystem, or whatever. But if you've spent X years with tech Y, you will likely be faster than learning something new (and learning the idiomatic methods of that new tech). Figuring out when to dig deeper, and when to move on... again - no single choice on that.

I may have shared it before, but I saw a company moving new dev away from PHP, and moved to a combination of python and node. "It's so much easier to hire people!" But... they were largely hiring jr and mid level people, and they were doing greenfield redevelopment of some of the PHP stuff. And... they'd attempted a rebuild of the PHP stuff once, but made the same mistake as the first time; primarily one person, working on their own, often offsite, not interacting with other people.

Moving to python/node, they hired more/cheaper people, and the rewriting team required everyone to work together. The languages were pointed to as the reason behind some of the early success, but it was far more the processes around the development that provided the success. With enough people, forced to write cleaner code the whole group can understand, as well as requiring tests and documentation... yes, the outcome is going to be better than requiring one person to build a lot of stuff on their own, without providing adequate time for testing, documentation, or collaboration with others.

Likely most of us have come across enough bad JS/Python/Perl/PHP/Java/C#/etc to understand the quality of the code is only tangentially related to the language, and far more about the processes and expectations set around the development.

Re: PHP Popularity: Is it decreasing and what to do about it?

#47

Earlier quoted context omitted.

No, languages simply matter much less than they once did due to widespread adoption of best practices and good design. The tooling around languages matters much more. C++ isn't still popular because it's the best language. Only real reason I'd always pick PHP over JS is not because I love PHP, but because Laravel is better than any node framework.

While you may pick, most developers do not. You are not the most developers, as you are special and probably much more talented. They pick JS because they know the language best and are more productive in it than in Laravel. There is nothing Laravel can do about it - being best is not going to change the direction, because the limiting factor is the knowledge of programming languages of most of developers.

They picked JS for the server because they have a choice in what languages they can run on the server, but they don't have a choice about what languages they can run in the browser, so JavaScript it is.

There are HUGE advantages and efficiencies to using the same language in the browser and the server.

Most developers are (rightfully) lazy and simply don't want to learn and juggle two different languages in two different places, when they can use simply one language everywhere.

For example, when switching between PHP and JavaScript, you have to remember that the ?: ternary conditional operator in PHP has idiotic left-associativity, so you have to use extra parenthesis to disambiguate it, while the identical looking ?: ternary operator in JavaScript and all other languages has sane right-associativity.

"I'm not a real programmer. I throw together things until it works then I move on. The real programmers will say Yeah it works but you're leaking memory everywhere. Perhaps we should fix that. I'll just restart Apache every 10 requests." -Rasmus Lerdorf

"I don't know how to stop it, there was never any intent to write a programming language [...] I have absolutely no idea how to write a programming language, I just kept adding the next logical step on the way." -Rasmus Lerdorf

"We have things like protected properties. We have abstract methods. We have all this stuff that your computer science teacher told you you should be using. I don't care about this crap at all." -Rasmus Lerdorf

Re: PHP Popularity: Is it decreasing and what to do about it?

#48
post #4

PHP popularity is decreasing because there are better tools for the same niche today. The same happened for Perl in 00s. The same is happening for every web backend language, as JavaScript is becoming ubique due to it being the de facto and only choice for the web frontend. Maybe PHP can be made better, but it would need some radical changes and then the question is that if it’s worth the effort and maybe to pick up…

What's the JS equivalent of "place an index.php file in a folder to deploy"? What's the JS FOSS equivalent of ProcessWire as a CMF + CMS? What's the JS equivalent to e.g. DreamHost and other drag + drop hosts? (Legitimately curious, and I'm mainly inquiring after equivalents-for...better-thans would definitely be interesting)

[deleted]

Re: PHP Popularity: Is it decreasing and what to do about it?

#49
New languages are hopefully made taking into account all the lessons learned from previous mistakes older languages made. Old languages can't change too much or they just become hell to upgrade, so they can't compete with the newer ones.

I don't think there's much of a problem with this.

But I will still setup a wordpress if I need a quick site.

Re: PHP Popularity: Is it decreasing and what to do about it?

#50
The world that PHP grew up in has changed. The language and community have matured, and in the process PHP has lost most of its competitive advantage: low barrier to entry.

It used to be:

  * Moving from static HTML to dynamic server code was a matter of changing file extension and adding PHP tags.
  * Many shared hosting services supported PHP.
  * Deploying was a matter of copying files to the server.
Projects that started from HTML + PHP tags grew and became unmaintainable messes. The PHP community learned from this and evolved in a different direction. You can still _write_ PHP code in the old way, but it's strongly discouraged and (rightfully) seen as a bad practice. You don't even use PHP as a templating language anymore. Symfony and Laravel have their own templating languages that dynamically compile to PHP.

Modern PHP code looks very much like Java or C# -- classes, OO design patterns, and so on. Except in most ways, it's worse than Java or C#. Why would anyone start a new project in PHP?

Deploy models have also changed. You're usually not copying files to servers, but deploying Docker images or other formats. PHP has no particular advantage in this new world.

If PHP wants to turn things around, it needs to figure out what makes it unique or better than other languages. Right now, there's really nothing.

Post reply on HN