6 ms·
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 bac
by miohtama 4y ago
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 some of the new tools instead.
- yvan 4y agoI am curious what are the radical changes you are thinking about that PHP needs.
- themodelplumber 4y agoWhat'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)
- boringuser2 4y agoDo you really think the inability to create anything but an index.php file is the bottleneck? Those people just use drop-in tools now which are better than custom applications for a large portion of standard use cases.
- themodelplumber 4y agoBottleneck? Just asking what's the JS equivalent in convenience for deploying a simple project. It doesn't need to even look like index.php, just needs to be as convenient, ideally? Drop-in tools? Examples? I was using PHP drop-in tools back in 2004 but I'm not sure if that's what you mean.
- com2kid 4y agoFor JS, you need to setup a listener like PM2 and point it at the folder, but once that is done, you can drag and drop and index.js file into place and it'll all work as expected.
- 9dev 4y agoPeople 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…
- djbusby 4y agoExactly! Those languages are working on their own cruft!
- wvenable 4y agoThe 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.
- themodelplumber 4y agoExactly, if one is not developing PHP for the enterprise (maybe some non-enterprise simple projects still use opcodes though? lol), it's silly not to leverage index.php for all it's worth :-) So where is the hyper-simple JS equivalent for that class of non-enterprise projects, is what I wonder...the enterprise stuff has always been heavy and loads projects down with maintenance debt.
- toyg 4y agoThe equivalent for JS is just an HTML file.
- 9dev 4y agoThere are projects between hobby users and Facebook, believe it or not :-) I actually like using a reliable package manager, a wide ecosystem of good packages, and modern language features. There is nothing "heavy" about modern PHP, unless you want it to.
- 4y ago
- smcleod 4y agoOh that's easy - just install 10 insecure npm packages that each install another 10 npm packages (some of which are even maintained!) then make sure you remember to bundle it up in a nice, heavy electron wrapper. Then you're all ready to distribute it via some random App Store - just don't forget to charge a monthly subscription while you're at it. /s
- themodelplumber 4y agoDon't do this to me, I maintained one of these projects years ago, and am still somehow billed $0.30 a month for the privilege of the original dev having used Amazon tools for it :D
- smcleod 4y agoThe pain is real! Speaking of Amazon - AWS CDK is promoting lots of terrible practises mostly built on barely supportable TS/JS, it's so... so terrible.
- joquarky 4y agoI've been doing web development since before the <table> tag was introduced. > just install 10 insecure npm packages that each install another 10 npm packages I still don't understand why companies are fine with this. At my last job, even principal and staff level developers needed every Windows or Mac application install vetted by IT. We had real time system monitoring on all employee workstations that ate up half the RAM and CPU resources and constantly kicked us off the VPN for even the slightest quirk (including the CPU redlining due to scanning). But npm dependencies? Nothing. Install whatever you want and push it to production. This is an S&P 500 company that deals with tons of PII.
- chclt 4y agoBecause the working part of an organisation such as the one you describe tries to continually optimize away these restrictions. NPM (et al) is a good way to obfuscate the fact you're pulling unknown code to get shit done and processes haven't caught up yet. I'm not saying this is good, but the reality with these company-internal restrictions is, that the most productive people find ways around them and are rewarded for it.
- armarr 4y agoAn html file with a <script> tag
- themodelplumber 4y agoI see we both read the same JS Game Dev book...
- rikroots 4y agoExactly this. It's the perfect approach for teaching people the basics of how to use my JS library - https://scrawl-v8.rikweb.org.uk/learn/first-lesson/ https://scrawl-v8.rikweb.org.uk/learn/first-lesson/
- DonHopkins 4y agoWhat 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.
- archerx 4y agoI like switching gears, I truly don’t find it an advantage using the language for both. Have separate languages makes the distinction between backend world and front end world very clear. Also the backend code is mostly data manipulation and the front end code is mostly rendering so there is very little overlap in similar functions for both. The separation helps keep things tidy in my brain. I much prefer not having to write JavaScript everywhere, not every problem is a nail and not every solution requires a hammer.
- ihatepython 4y ago> 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? You can simply compile your PHP code to wasm with emscripten, and then run it in the browser. Pretty straightforward. No more switching gears.
- ThatPlayer 4y agoI believe you'll need to compile the PHP runtime itself with emscripten, since LLVM won't take PHP code, but PHP compiled to wasm will!
- pjmlp 4y agoAs long time Java, .NET and C++ developer, this is oversold, beyond some form validation there is hardly any value sharing code. And in what concerns validation, it can be automated on most frameworks, which has to be done on server side anyway due to security concerns.
- itslennysfault 4y agoWell "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
- themodelplumber 4y agoThanks for the info! > AWS, Azure, Google, CloudFlare, Digital Ocean, etc I'm always curious to know if there are more casual options in this space, for non-earthshaking projects. Maybe more like how DO was at the beginning?
- belmont_sup 4y agoHandful of great new hosts I’ve seen pop up: Render.com, Fly.io, northflank. And I actually like AWS lambdas, so great option for me is SST.dev, which wraps AWS CDK, and provides an actual live development workflow with actual AWS resources.
- deleted 4y ago[deleted]
- edmundsauto 4y agoI have a hobby app that is index.html and I just manually add <script> tags to load libraries. No build step, I just use GitHub to cloudFlare pages to host.
- asdfman123 4y agoIt’s funny that it reads like some novel approach, but a script tag within an html page is what JavaScript is and was designed to be.
- anonzzzies 4y agoI would stick with Laravel or something like that if I were you. The rest is good for your resume, but if you don’t need that, I would forgo the misery that is js/ts dev.
- tommica 4y agoOh, processwire looks interesting, first time hearing about it
- 0xblinq 4y ago> What's the JS equivalent of "place an index.php file in a folder to deploy"? 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.
- boringuser2 4y agoNo, 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.
- happytiger 4y agoThat's why I keep using PHP in my projects personally. Laravel is just so damn pleasant to work with.
- miohtama 4y agoWhile 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.
- DonHopkins 4y agoThey 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
- asddubs 4y agojavascript has the advantage that front and backend can share code, but as a language it's much worse. php at least has been able to break backwards compat to fix its worst design mistakes, and natively has typing
- vi2837 4y agoThere are few factors why PHP popularity is decreasing, not because it is really bad. But very often other languages build its popularity on promoting how "bad" is PHP. It is also no longer fashionable as it was in the beginning, but other language promoted as such. And more.. So, I think, rebranding and good marketing could help here.
- nashashmi 4y agoPhp got complicated. So it’s value is decreasing.
- rafark 4y agoWhat are the better tools? Are you suggesting JavaScript is better? Exactly how?