by cupcake-unicorn · 5y ago · 0 comments
If someone is new to software development and in an area of the world where it's not mostly PHP shops, so bigger cities, I don't really understand the benefit.
PHP is often used to do certain things or it may be faster for you to whip something up in Laravel but if you had someone who was a complete blank slate and could chose any language and any framework in a town that doesn't have PHP jobs...why? What's the reason then?
I really think these articles come off really strange like they're trying to convince me as a "fact" but are really just nostalgia, like someone who goes off about how "cars were built so much better back in the day, there's still uses for older cars!" Maybe there is a grain of truth there and some real reasons behind it (repairability) but for 95% of use cases it's just that there's no contest, for a new driver, in an average situation there's no benefit towards going to an older car, and the guy going on about "older cars are the best", while they may have some weird reason that does actually apply to them (and as far as this analogy goes, I think Fortran is a better example than PHP in this case than PHP as for some maths applications it apparently still has an edge but that could have changed) honestly it's just nostalgia/trying to indoctrinate people...
In comparison, other programming languages are hard to figure out. Python, Ruby, Java etc all need some kind of a package manager to install dependencies (PHP apps are self-contained) and need to have the correct runtime version installed (PHP just needs to be in the general neighborhood of what's required, since most broadly used packages seem to be written in a backwards compatible fashion). This is scary and unfamiliar, and highly technical. If you're deploying on a VPS (because rarely anyone has managed Python/Ruby/Java hosting services), you've now also become the sysadmin with full responsibility for the box, including patching and downtime. Compared with shared PHP hosting, it's bonkers.
> package manager to install dependencies (PHP apps are self-contained)
PHP has Composer, which is one of the best things to happen to the ecosystem. Chances are, the piece of software you install will manage its dependencies in this way, and I'd be reluctant to install it if it didn't, as you wouldn't be able to update the software easily.
Not a fan, but that is definitely a very good argument.
Then you have the myriad of static site hosts that also take 2 clicks to host something without even having to write any code.
Who is writing the code in the first place? They're uploading existing code to a shared host through FTP but then who wrote the code? Is it a prepackaged Wordpress? But then Wordpess hosts already exist.
If the developer is giving them a zip to upload, why can't the developer handle the deployment as well?
You moved the goalposts so far that the example doesn't make any sense anymore.
If we're talking about simple templates to open a store or a simple landing page there are so many no-code options like Wix/Shopify/SquareSpace/Square that I don't think PHP offers any significant advantage.
Languages tend to go through a few years of flavour-of-the-week fads (think of the Vue/React/Angular competition, and all the also-rans that we can't remember now). If you get in too early, there's a fair chance you'll bet on the wrong ecosystem, and end up with unsupported dependencies or difficult to maintain code. In the worst case, you scrap the whole thing in six months and write it for a new framework to keep it alive.
PHP went through that phase back when "we've got to support IE6 users" was a legitimate talking point. You can be reasonably confident Wordpress or Laravel are here to stay.
PHP is also fundamentally a hugely battle-tested platform. It's been ran on 486s in the broom closet, and entire rack clusters in data centres. If you have some performance or usability problem, there's a good chance someone else has had it already and worked out a solution. With some new language, your odds of "never seen that before" errors are much higher.
These days I write server code in C++ :(
I look at it this way sometimes: there are the interpreted languages, the VM-based languages and then systems languages.
PHP is a good option in the "interpreted" languages category, if your problem domain is web-based, as it includes a lot of built in functionality for web-based problems. It's also open-source, reasonably performant, has an improved type system, has a C-like syntax and enjoys features inherent to a scripting language e.g. fast startup time, so would be a good option for lambdas.
Finally, one of the features that has been unreasonably good about PHP is the shared-nothing request model, which makes running a website on PHP a stable experience, in an imperfect world of weird state issues and libraries that might sometimes have a bug that leaks memory.
There are also other options in the "interpreted" category which I would fully expect people to also look into, however that's not to say PHP isn't a good contender for this space, given learning time is a limited resource.
However I would expect people to know a VM-based language and a systems-based language (or at least a bit of one) in addition.
Do you plan on creating a start-up that you intend to scale to a babillion customers? That you intend to hire teams of developers for? Probably not a good idea.
Are you a new programmer trying to figure out which language to learn first? Absolutely not. Python, Java, JavaScript, C# are much more flexible if nothing else. Anybody who tries to convince new programmers to learn PHP is doing them a great disservice.
Not interested in PHP in the slightest, but how is this myth still going around?
Wikipedia, Pornhub, Facebook (initially at least) were all built on PHP. There are hundreds of other examples.
Laravel nowadays has an outstanding reputation and I doubt it's performance is lagging so far behind Django for example.
More generally, after all these years I still need to see a story of a startup that failed because they chose the wrong stack. There are some blog posts with spurious claims in this sense, but really, when has a startup with good product-market fit and a finely designed product ever failed because they chose PHP instead of something else?
Maybe you haven't heard of startups failing because of choosing the wrong stack, but I'll wager you don't hear about most startups failing because...why would you? Also, have you heard of startups re-platforming? Either because the current stack is falling apart or the company is acquired by a bigger fish and they need to integrate with other services so parts end up getting rewritten to Java/C#.
The fact is PHP is good for making websites, and that's all you'd really want to do with it. There are other languages that are good at making websites and they are more popular and have other benefits.
If you are building things with PHP and it's working for you, then awesome. But seriously, why encourage it?
But I agree with you.
If anything, PHP has proven it works in this regard.
PHP works, but imho starting a new company or career with PHP is a mistake.
It depends what location you're in. In Europe there are pockets where PHP is very popular, where learning it can open up the job market.
In Europe there is a lot of PHP. Even in the bigger cities. And as someone who knows a lot of different programming languages, modern PHP with Laravel is pretty hard to compete with on a productivity basis.