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 some of the new tools instead.
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)
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
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…
Those people just use drop-in tools now which are better than custom applications for a large portion of standard use cases.
My favorite way to do this is to add a custom script to package.json like:
"start": "pm2 start index.js --name myapp --watch"
Any file change will reload the application and if it crashes it will be restarted. So just scp/rsync files if that's your desired workflow.
In my experience, it's far easier and faster than setting up nginx, apache, fpm, etc, etc.
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.
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.
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.
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.
First of all, php is faster than python, and ruby and probably most dynamic languages except JavaScript.
So in terms of performance, modern php is ahead of the other languages and it scales well.
Regarding features, php has the best support for classes and types out of the three languages. So if you want to design a classic oo system, php has the best features language-wise.
Php also has a great community (good ides, good package manager, good open source libraries and frameworks).
What do other languages offer that php doesn’t have?
It's hassle free to host on a shared host and it'll be there forever
And I really like you touch on low barrier to entry. Right now, in my likely controversial opinion, modern Web Dev is a huge pile of excess complexity.
No wonder so many people turn to magical thinking, cargo cult coding or Uncle Bob -like messiahs.
Example on improvements
1) auto-escape output - one of the biggest reason not to use PHP for templating is that you need to manually escape your strings to avoid XSS, whereas a dedicated templating library can do this for you. This could be done with a either a special opening and closing tag or let you register a tag hook.
2) today you can use the alternative syntax for if, while, for, foreach, and switch
https://www.php.net/manual/en/control-structures.alternative...
This could be expanded for match expression, closures, and other block expressions.
3) custom HTML tag support, register a HTML tag like <my-form> and implement it thru an API, perhaps a class that implements an interface. And now you can do much better reusable components that can automatically close them selves instead of multiple calls.
e.g instead of
<?php open_form() ?>
<button type="submit">Buy</button>
<?php close_form() ?>
you can do <my-form>
<button type="submit">Buy</button>
</my-form>
In the first example you need to always match one function call with another function call ( manual work), in the latter example you HTML just needs to be valid, which many editors can detect for you.And it would be easy to share these custom components on github with composer.
Its not going anywhere. Or at least in europe its not.
Symfony et al have matured enough so they are usuable for allmost everything web related and if you dont plan to be the next google homepage, it will carry you VERY far.
Is it pretty? No. Is it efficient? No. But you will be able to find 10 coders for the price of 4, that will have your project iterate until you need something bigger and better. If you do not hate your staff, by then they can easily pick up golang and convert into microservices, taking it down piece by piece and making the parts more efficient that need it.
I’m interested in using the right tool for the job, not getting caught up in weird inside baseball attribution wars. IMO, PHP is often not the best tool because it’s a shitty language. If it has a “Rails clone”, that makes it better, not worse.
"PHP is used by 77.5% of all the websites whose server-side programming language we know."
It’s super cozy and honestly I don’t want it to get popular again so it can remain drama free and cozy.
I settled for writing frumpy code at frumpy companies for years, but my life got better when I tried to chase after things a little more.
I'd hate to see the other communities then! I think of PHP communities as full of drama, whether that's fads and dogmatism (which usually changes every 3-5 years) or people lacking interpersonal skills and unable to keep conversations civil.
Speaking words of wisdom, PHP.
It is very fast for me to start, test & itterate.
I've also tried Node but idk sometimes it can hugg memory and even crash, which just never happened with PHP.
It is a little sad but I don't really care anymore because I am not doing client work anymore.
Edit: just to add that I also never really could stand promises in async execution. Such a headache.
Edit 2: also can you believe it that with Node, the script is also the server??? Who in their right mind thought this was a good idea? Like when the script crashed, it crashed the whole app for everyone.
That is how most modern web systems operate. It's very rarely a problem, because decent error handling (built in to most frameworks) limits the scope of these sorts of issues to a single request. IIRC, all of the major Node.js HTTP frameworks will catch exceptions for you and respond with a generic 500; I'm not sure what sort of system you had where your errors were bubbling up further.
The former came mostly from the PHP camp. The lack of OOP where it was pretty desperately needed was unproductive at best, and at worst yielded a codebase that was so unmaintainable we had to double any time estimates for backend work.
For tooling Laravel, at least the last time I touched it, was pretty good with its scaffolding. Relying on Composer was also very welcome. Using IDEs like PhpStorm was pretty good, but took a lot of configuration.
The one thing that really burned me, however, was the amount of effort it took to get a debugger actually working. I am certain the climate is better now, but at the time almost no emphasis was put on actually using a debugger for development. You could get Xdebug running, but you have to know how to configure your local dev hosting environment properly. If you used a prebuilt package like your WAMPs or XAMPPs or whatever you, you got 90% there, but it's so bloated and didn't reflect your production environments. Vagrant was great... if you spent the time to configure your Vagrantfile with a lot of testing.
These days it takes about 30 minutes to reinstall Windows, install VS, clone my project, hit the run button and I'm off to the races. Is everything frictionless? No, of course not, but I can get to actually building my application without pulling my hair out.
The author links to the person thinking that HypeScript is a good name. He says:
"The name HypeScript sounds like a logical name for me, it pays its respect to the name PHP (PHP: Hypertext Preprocessor) as well."
That would be like suggesting that IBM rebrand itself "BizCompany" to pay respect to its own name (?)
Edit: Wikipedia says "PHP was originally an abbreviation of Personal Home Page, but it now stands for the recursive initialism PHP: Hypertext Preprocessor."
I find php easy to write, i can get an API running with a few lines of code without any library, and I find it very easy to deploy.
There is no app server or MVC to worry about. Every page is a template.
I would like the convenience of replacing one file somewhere and have the file be picked up by the server, similar to PHP.
I would also like to separate release and deploy and do an atomic load of the server.
I think there are Clojure projects to preload the JVM.
So when I upload the new version of the code, I can decide to release the feature when I choose to, rather than automatically at deployment time.
I think people use feature toggles to separate release and deploy.
So what? What's wrong with PHP becoming irrelevant? Surely nobody would complain that ColdFusion is finally irrelevant. People should focus their time and energy on better solutions than PHP or ColdFusion.
Yes they should, but none of the 'solutions' are actually much better. We should all just accept the cold, hard reality that the web was a huge mistake and never should have been created. Nothing good has come from the web. Personally I was much happier with usenet, ftp, and gopher.
* PHP documentation sucks. It’s demonstrably incomplete in important cases, and I guess to make up for it they allow anyone with a browser to add comments and examples, many which are distracting and very poor quality. Furthermore, things that start mattering at scale, like memory management, database connection configuration, etc. seem to be solved but completely undocumented.
* As a result the internet is littered with millions of additional “happy path” examples, many of which are outdated as well.
* PHP doesn’t have a big corporate sponsor who is putting serious resources towards improving documentation, tooling and other resources. I would love for Facebook or Etsy or someone who’s gotten a lot of milage out of PHP to take the lead here.
* PHP is European/Israeli led (in the sense that many core devs seem to be there), and a lot of materials don’t seem to cross the pond. (Maybe we Americans put more value in hype and marketing… I don’t know.)
* PHP has warts, which “senior” devs nit-pick mercilessly, yet it really isn’t any worse than JavaScript in that regard. (For some TypeScript-hidden runtime bugs are culturally allowed to be ignored, because TypeScript is cool. JavaScript/Node forces you to use an event loop whether that makes sense or not. Etc.)
* Again, without a large, corporate backer, anyone thinking about “career” worries about getting a job, because there are not large corporate backers. (See how this works?)
The whole situation reminds me of where JavaScript was around 2010: Things have gotten seriously better but the wider-world had not caught on yet. PHP has some very impressive engineering and has proven itself again and again as a solid option, that is, it’s not perfect but it’s good enough.
Where it ends up is hard to say: Maybe it’ll end up like BSD Unix, with ardent fans but not the most popular kid.
It kinda says it all...
https://w3techs.com/technologies/history_overview/programmin...
Celebrate.
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?
But I've always said that PHP's popularity was due to its availability on free hosting providers. However nowadays, you can get free hosting for a plethora of languages. So more competition, and also there are so many more languages that are competing for the backend nowadays.
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.
1) First, understand that one audience matters particularly for programming language popularity, and that is people who are starting their careers. If you learn a language and use it for a few years, it tends to be a language you continue to use throughout your careers.
Here, we have no data. But I can tell you as someone who works with a lot of early stage startups and 20-somethings who are diving headfirst into programming for their startups for the first time, the language of choice is Python, followed by Javascript of some kind.
I have a long history with PHP and dearly love it as a language, but the concern I have is that it's not getting picked up like it was. Still love using it, and boy is Laravel productive for a small team.
That said, this is anecdotal, and I don't have any data here as the programming language surveys are always so broad they don't really have this kind of segmentation to spot early trends. Curious what others are seeing however...
2) Second, as chinabot pointed out, in the short term, AI is likely to supplement the work of programmers, making certain tasks faster and more efficient. However, as AI becomes more sophisticated and capable in the long term, it has the potential to largely replace a lot of programmers. In particular, AI's ability to automate the coding process means that many routine programming jobs may become unnecessary. While this shift may take some time, it's important for those in the programming industry to keep an eye on emerging AI technologies and be prepared for changes to come.
Does that imply that languages that are for working with AI would be the better programming languages to learn? Python, Julia, C++, Java and R are the current core languages in AI land. I don't think it matters in the short term, but the AI shift looks so big it could matter a lot in coming years.
IDK, doesn't look quite as cohesive and convincing as arguments after I wrote them down, but there are some pretty interesting points in here so I'll post it anyways to add to the discussion.
If you're using an IDE already pretty much any language could be the same.
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.