r/PHP • u/Alarmed-Setting-5152 • Aug 29 '24
PHP is Still the King!
Alright, hear me out. After years of diving deep into the endless sea of JavaScript frameworks—React, Vue, Angular—you name it, I've had enough.
About a month ago, I stumbled upon an article that's been living rent-free in my head ever since. It said something that hit me hard: frameworks like React are designed to make us "code slaves" for companies. They're over-engineered traps that keep us in a loop of learning and dependency hell.
And honestly, I couldn’t agree more.
The author argued that if you want to build things, you should consider going back to basics—with PHP. I couldn’t stop thinking about it for a week, so I decided to give PHP a try. At first, I was skeptical. I mean, PHP? Isn't that the language everyone mocks for being outdated?
But the more I thought about it, the more I procratinated.
Then I saw a podcast on Youtube (Lex podcast) and finally, I gave it a shot.
And wow—it was like a breath of fresh air! With PHP, you just need an index.php file to get started—no endless configurations, no build tools. Need to handle a form? Use $_POST or $_GET, and you’re done. Want to connect to a database? Write a simple SQL query. User sessions? Built-in and ready to go. You can build entire web apps with a single file.
Everything just works. It's so straightforward, and I realized I could build apps faster without the bloat of modern frameworks. If you’re tired of the framework rat race, PHP might be the antidote you didn’t know you needed. I’m loving the freedom and simplicity, and it’s been a game-changer.
Think about it—modern tools are built for companies to solve their problems, not yours. You're constantly chasing the next big thing, stuck in this cycle of relearning and refactoring. But the OGs—PHP and jQuery—are still absolute legends.
If you’re new here, don't make the mistake I made by jumping on every new framework bandwagon. Save yourself the headache and learn PHP and jQuery. You can build fast, scalable apps without the complexity. Stop grinding to keep up with the latest JS trends and start building something that’s truly yours. Less complexity, more productivity. Time is money, and these two give you the best bang for your buck.
98
u/itemluminouswadison Aug 29 '24
PHP's strength is how easy it us to get up and running; especially back in the era of shared hosts. upload your stuff; done.
if i wanna make something, PHP is the quickest way to get it out
50
u/wh33t Aug 29 '24
I never left PHP, never saw the appeal.
PHP's greatest strength is also its greatest weakness, it's really easy and straight forward to make shit happen with it.
27
u/jkoudys Aug 29 '24
Like with people, sometimes even positive stereotypes about a language can be a bad thing. My other big language is Rust, and it gets a lot of clout for being super-efficient and safe, but then people think it cannot be used for anything other than programming microcontrollers when that's just not true. PHP gets it from the other side, where it has such a reputation for being the pragmatic choice when you simply need to get business requirements in place. But since PHP7, it's actually a pretty good choice for performance work too. There's a niche that used to be filled by Java, which PHP struggled in versions <=5, where it now performs quite well.
I'll often say that when people think they need to code something in a different language because their PHP is slow, that they're usually right. But that other language, 99 times out of 100, is SQL. PHP supports prepared statements out of the box. Take any needless nested loops loading way too much into memory, get good with SQL, and put it there. It's what it's for. Anything really slow can be tossed into memcache or redis for if/when you scale.
Unfortunately the w3 didn't get HTML to where it should've been, but thankfully we have htmx now if you want. Presentation logic that goes in a browser can render off of endpoints that simply render the html. If it's a webservice, your presentation layer is just JSON anyway. Build an assoc array and throw it into json_encode.
I ran across a leetcode the other day that didn't have a Rust version, so I went back and did it in TypeScript. It was a simple flatten-a-b-tree problem. Did it with generators. TypeScript ran in 80ms, Python in 60ms. I tested a C version and got 15ms. Ran the same logic in PHP -- 18ms! More importantly, the most optimized ts/py approaches are so mangled they look like complete garbage, but the PHP one still looks good.
22
u/ganjorow Aug 29 '24
Funny how that statement is also born out of consuming yet another piece of influencer content. It will never stop, will it? Just an endless pendulum bouncing forth and back.
Really glad all I had was O’Reillys library and assholes on newsgroups. This forced me to discover most stuff myself. Certainly took longer, but this over-dependence on outside opinions is just blerch.
9
u/New_Speech7456 Aug 29 '24
You should try HTMX too if you haven't already. I've been using a PHP & HTMX combo on my personal projects and I love it, the antidote for framework and javascript fatigue.
31
u/miamiscubi Aug 29 '24
I have to push back against this a little. Pieter Levels is not a typical dev running into typical problems.
He is first and foremost an entrepreneur that happens to use PHP, and he can do as he pleases. He doesn’t have any of the collaboration constraints, nor of the required security restrictions that many have.
I think there’s a difference between being a web dev that gets a salary / freelance income and being solo founder.
I am a solo founder and use PHP, but would not go back to jquery. My preference is twig with htmx for all responsive requirements. It’s also important to note that if you’re building anything that is UI intensive, React is probably the best solution for you.
I think it’s important to know what PHP is good at, and what it isn’t great at, but ever since the Lex Friedman interview, there are many posts that seem very hypy about PHP without recognizing that the language has its own limitations.
7
u/E3ASTWIND Aug 29 '24
Don't forget that hosting a small PHP website is still inexpensive and there are countless automation tools for it.. Its a mature platform.
7
u/fr3nch13702 Aug 29 '24
Someone should mention to him: composer, syncing , phpunit, phpstan, phpcs.
10
u/MajesticReference335 Aug 29 '24
Jquery is bloated nonsense imho.
Vanilla js and PHP is the way to go.
5
u/CensorVictim Aug 29 '24
what is up with all these posts lately?
5
u/Street_Stuff1927 Aug 29 '24
PHP is been bread and butter for me and my family from last 15 years.
9
u/Egst Aug 29 '24
Agree.
(By "pure" I mean no overly complex frameworks.)
Strong disagree.
jQuery is completely unnecessary with the state JS is in nowadays. If you ever feel like you need jQuery, check out https://youmightnotneedjquery.com/. Pure JS is really powerful and you could argue the same things you said for pure PHP. You can just as well create simple web apps with just a single file containing HTML, JS and CSS (although it is easier to work with separate files). No need for any of these frameworks especially if it's just a simple app.
8
u/unity100 Aug 29 '24 edited Aug 29 '24
Moreover, the users dont give a sh*t whether the website that they are visiting is rendered with React et al or not: All they want to receive is a usable web page fast enough.
Also a big advantage of PHP: All the PHP versions that come with different distros are maintained by those distros. So when you pick a linux variety with LTS support, it means that the PHP version that comes with it will be maintained way beyond PHP's EOL by patching them against security flaws and major bugs, so you can just concentrate on your business instead of having to juggle versions and do disruptive upgrades every few years, leaving aside every other year like the frontend frameworks. And each PHP version's own service life is long enough, so go figure. You built something, for years it works stable on a system that is supported by the best the industry has to offer without disrupting your business. That's why businesses, ecommerce sites love stuff built on PHP. Today, PHP is a language that is intended for actual business instead of programmer trappings.
4
u/TurtleVerified Sep 01 '24
I’ve been using PHP since version 3 (1998 release). With a mix of PHP on the backend and html/js on the front-end, there’s not a single thing I haven’t been able to accomplish. To this day, I still build everything with it even though I’m constantly mocked by younger “devs” for doing so.
11
u/s1gidi Aug 29 '24
Whut? most frameworks are made for developers with developing in mind. I bet a lot of the creators wished they got back some money from these big companies for all their efforts.
I don't know, are you? Maybe that's on you then?
The reason they exists is not to trap you, but to keep your code organized and workable after you need more than just a few uncontrolled unsecure sql queries from unescaped input and some jquery mess which you could just as easy do without jquery..
But hey, at least we got another post claiming that everybody is mocking PHP (for real, I haven;t heard anybody saying that the past 5 years outside of the PHP community and trolls). So thumbs up I guess
23
u/eyebrows360 Aug 29 '24
Why are you mentioning jQuery? That's long dead and doesn't really give you anything any more.
Also, what's with the influx of posts like this the last few days. Bit odd.
3
u/benabus Aug 29 '24
They all solve different problems.
Modern Javascript frameworks aren't meant to be the end-all-be-all. They're meant to build robust single page applications. If you're doing anything remotely complicated on the frontend, they speed up development time tremendously. They can also make it easier to work in a team. If you have to build a robust front-end application quickly, you're not going to do it in just PHP and JQuery.
Sure, if you're building something by yourself that just needs to work, go for it. I do little php hack scripts all the time. But it doesn't scale (from a dev point of view, not computationally, obviously). As soon as you start building more complex apps (even server-side rendered apps), you'll be kicking yourself for not using a framework like Laravel or something (disclaimer: I don't know the best php frameworks).
Frameworks are meant to cut down the boiler plate so you can focus on business logic rather than run-of-the-mill things like sql injection or updating numbers on a page.
PS: Don't start new projects with JQuery. The reason it's still in use is because it's still in use. There's a lot of legacy code bases and such that rely on it. If you want to go back to basics, learn plain old vanilla Javascript. There's nothing JQuery can do that vanilla JS cannot. It was a product of its time and was instrumental in the evolution of the web, but there's no good reason for it unless you get a job where you need it.
3
u/inotee Aug 29 '24
This post doesn't align with zoomer culture. The message of this post is only to be known by seasoned and experienced developers. We all know what works and what doesn't. Leave the good jobs to the happy few.
3
u/Different-Strings Aug 29 '24
I’ve been doing PHP and Angular for years and years from web stores and enterprise dashboards to mobile apps and I’ll be damned if I’m going to start doing JS backends.
3
u/chajo1997 Aug 29 '24
Always was
3
u/judgedeliberata Aug 30 '24
I always found it hilarious when I see devs ignoring PHP. It is absolutely the fastest way to knock out an idea.
5
u/cristiand90 Aug 29 '24
You are crapping on frameworks but Laravel is revolutionary for php and I wouldn't start any serious project without it or symfony.
If you think php is simple, a good framework is magic. And much more secure if you are new to web dev.
4
u/brzezmac Aug 29 '24
I was always baffled how stuff that was done quickly in php / html, dang even in Java was a real fight with the latest JS frameworks and still it was sold as the next best thing to sliced bread. I’ve developed my taste to Vue as it delivered on the promise (pun not intended) of incremental adoption but lost interest in it after introduction of composition api and now do my stuff using vanilla JS where I need it.
5
u/[deleted] Aug 29 '24
Yeah dude I’m building a SaaS in nuxt.net and the amount of bs that I have to do compared to a vanilla php all is ridiculous. With that being said, I wouldn’t recommend vanilla php, at least use a framework like laravel via ddev container
2
u/aniceread Aug 29 '24
No.
2
u/flippakitten Aug 29 '24
Nature is healing.
I'm an ex php dev in the rails world. There's no easier way to get html to the browser than simply using php.
Love php but I love rails more for apps. It's a personal preference.
2
u/Fun-Fun-6242 Sep 02 '24
I find that even myself as a senior developer can learn when not using any framework at all. I recently did an exercise to use some code conversion tools to convert c# asp.net to php. This exercise had me learn about routers, the mvc stack underpinnings , orm, dependency injection , other aspects we take for granted when using a framework .
3
u/YahenP Aug 29 '24
The author did a good job of throwing something on the fan. But overall the idea is pretty pointless. Where are the vacancies for index.php developers?
4
u/Miserable_Ad7246 Aug 29 '24
You are mixing front-end frameworks with backend ones. Backend frameworks are stateless, while frontend SPAs are stateful. Statefull code is much harder to do. Also you can not completely emulate what you do with SPA just with PHP.
I agree that modern SPA frameworks are overcomplicated, but PHP is not a replacement for them, just like never Java or C# or GO is.
5
u/barrel_of_noodles Aug 29 '24 edited Aug 29 '24
React is a library, not a framework.
Why jQuery? You don't need it. Regular JavaScript has everything built-in now. (The issues JQuery solved aren't issues anymore.)
This just sounds like you didn't understand basic frontend.
Tools exist because they solve problems. Use a tool if it's the right tool for the job.
Ever try to unscrew a bolt, but you don't have the right spanner or wrench?
2
u/punkpang Aug 29 '24
I, for one, am glad to see that there are devs who are starting to take the blue pill in order to think for themselves, without blindly following the herd.
Surprisingly, in our line of work - old and boring are positive terms. With PHP, one can build stupidly powerful apps because - it's simple, straightforward and like OP said - one can start right away.
To untrained eye, these are disadvantages when in reality - these are such overpowered advantages.
Welcome back to the basics, enjoy your stay! :)
2
u/YahenP Aug 29 '24
I don't quite understand your idea. How will PHP replace React?
1
u/Christosconst Aug 29 '24
Glad you liked it
1
u/Jakerkun Aug 29 '24
the reason why i like php, its easy to use, it have everything you need for web development, as you said almost zero config, even without frameworks like laravel you can do whatever you want, you dont need it, apps that today are consider highly performant can actually in php work on cheap potato shared web hosting, its less headache compare to everything "modern" today
1
u/ElectricJacob Aug 29 '24
If you're looking for minimalistic libraries, you should check out handlebars and mustache. They're awesome when you want to avoid the complexities of libraries Angular and React.
1
u/Hugoacfs Aug 29 '24
If you need an API or poc something, there’s a lot of PHP stuff out there to get going fast. For front end projects I don’t think I would favour PHP over others since you’ll have to get something to go with it
1
u/davitech73 Aug 29 '24
i would agree that php is much simpler to set up and use. i'm working on a java web application right now and it's something of a nightmare
but some of the php frameworks are still helpful. especially when it comes to security issues. unless you're familiar with how to write 'safe' code you can fall into some traps. the frameworks do add some complexity but they make up for it with database libraries, etc
1
u/SuicideSkwad Aug 29 '24
Not having much love with front end roles in my area but there’s a shit ton of PHP and Wordpress roles so decided to start learning PHP. Yeah I kinda love it
1
u/hellvinator Aug 29 '24
Sounds like you have never made a big application yet. Good luck with finding people to work on your project and can work bug free!
1
u/hvyboots Aug 29 '24
Yeah, I tried out bulidnig a React site way back in the day. It was cute until near the end some dependency failed and the entire site went down and took days of tinkering to get it back up again. I was coming from PHP where you can write a website and not touch the code again for years and this thing was already crumbling within a couple months, so I basically realized at that point I wanted nothing to do with such a brittle system.
1
u/koebelin Aug 29 '24
I love it, still have to look up needle haystack order.
1
u/Intelnational Aug 29 '24
Opened the linked article - wow! the author really likes images especially moving ones, doesn't he. There are so many there.
1
u/ln3ar Aug 29 '24
This is bad advice. jQuery is not the way to go in 2024, nor should you just rawdog an index.php file and superglobals. In addition to being very simple, php is also very hackable. If your form isn't secure, I can just upload a .php file through it and take over your server
1
u/amitavroy Aug 30 '24
But start with vanilla php? Not framework?
1
u/[deleted] Aug 30 '24
try alpine js, it pairs great with php and is the best js in html solution(simpler than react or vue and has no buildstep). just put the script tag that references the cdn
1
u/singlebit Aug 30 '24
I am using Python. Too bad i hate html and css, so I can't pick PHP.
1
u/maksimepikhin Aug 30 '24
I can say with 100% certainty that you have very little gray matter in your head called the brain.
1
u/Pale-Ad171 Aug 30 '24
I'm not sure why everyone says php is so great and all but it has always been a pain to configure php on servers because of the different extensions and settings needed to get it to run. I have used laravel in the past and it's great and all but deploying it has always been a pain. It'g good for crud apps. But the easiest one for me is nodejs, not much configuring there unless you start getting into typescript etc.
1
u/[deleted] Aug 30 '24
ASP.NET Core and Swift with Vapor are great type safe alternatives. At least in my opinion anyway.
1
u/gemmadlou Aug 30 '24
It's tempting to pick up all these libraries and frameworks, but it's hard to be productive when you have to fight against them. It gets in the way of making any progress quickly. But PHP was unwieldy at one point, but with typed params and returns, it's a joy to work with.
1
u/RDR2GTA6 Aug 31 '24
Underrated stack: PHP 8.3, Yii2, jQuery, htmx, MySQL, nginx
1
u/ErikThiart Sep 02 '24
There is no better language for the web than PHP.
PHP is for the web, there is nothing that competes.
1
u/DinnerRepulsive4738 Sep 19 '24
Dude. Please check hotwire.
1
u/iagofg Feb 10 '25
PHP is subjected to dependency hell as well... and you can develop for Java or node.js with less dependencies. Language does not make the dependency hell.
Some years ago I met a junior developer that for a real simple issue added 3 or 4 dependencies to the project :S yikes... maybe sometimes that is needed but he didn't even thought that adding those dependencies was a problem and yes, there were plenty documentation and even ready-to-adapt on 15 minutes code snipplets.
Adding 3 o 4 dependencies is not a problem, but if for every small iteration we add those soon it will become a hell in earth managing it, not saying compilations and building times.
Same for frameworks: newer developers don't even think in the problems of picking one framework or other. I meant: I know that sometimes using a framework is the best option, but man: think at least in the potential problems because there are many... specially when choosing between available frameworks. Or worse... "the this framework fits to anything boy"... owch... really anoying.
Of course there are develoments on which using some php scripts are the best option. Of course you will find developers that don't see it XD.
1
u/cwatty55 May 23 '25
PHP is far superior to many backend options due to its unmatched maturity and battle-tested reliability, powering over 75% of the web—including giants like Facebook and Wikipedia—for decades. Its extensive ecosystem, hardened security practices, and proven scalability make it a pragmatic choice for building robust, production-grade applications with confidence.
1
u/NL_Bulletje Aug 29 '24
Aren’t you comparing apples and pears? I mean: you compare front-end and back-end AND you compare frameworks (React, Vue, Angular) and a language (PHP). Those comparisons don’t really make any sense.
Compare languages or compare frameworks. Mind the purpose for which the subjects are intended.
Also, posting this in r/php seems to be an example of circlejerking, isn’t it?
1
u/AbramKedge Aug 29 '24
The one thing I'll add is that you can keep your code cleaner with templates - keep all your business logic separate from your HTML. I've seen a major household name product that had a series of 25K line files with conditional HTML, JavaScript and CSS - each file handling page display, form processing, and API calls. Absolute nightmare trying to work out what changing a line of code would affect.
I use Twig templates, but there are other options. It's so nice to have a clean PHP file that prepares the data then just hands it off to a template to render. Both the PHP and the Twig files are easy to read and modify.
1
u/endre84 Aug 29 '24
I've had this opinion since the jQuery days. and what it was back then was extend the dom with 1000 useless functions just to use $.
-1
u/Feeling_Photograph_5 Aug 29 '24
As a person being forced to work on a legacy PHP code base for now, I can say with authority that you're out of your f***ing mind.
It's not just the language it's the ecosystem. I'll take React and Typescript any time. I don't care what article you read.
0
u/[deleted] Aug 29 '24
For easy set up PHP.
For large rnterprise web apps consider Java Servlets.
0
u/Putrid_Acanthaceae Aug 29 '24
As a subjective thing. I enjoy typing js more then php.
Php looks and feels old to me. Js looks so much nicer imo
Other then that php has always got the job done for me but I wanted to learn other things due to php”s lower paid jobs (on average)
0
u/fishpowered Aug 29 '24
I'm glad you brought this up. I both agree and disagree with what you're saying.
I agree that npm packages can be a bit of a nightmare but we are actually heavily embracing React in our company...
It is overkill for simple things like your typical website (where jquery/native is just fine), but it really shines when you're making applications with a team. Once you start making UI components out of your interface or better yet, use a component library like Mantine, it's really hard to go back to the days where styles are constantly getting broken due to inheritance, poor style consistency between pages, copy paste code everywhere etc. It's much easier to get a professional looking web site if you embrace a frontend framework imo. Most programmers don't realise how terrible they are when they try to do these things themselves.
Conversely, I hate using monolithic backend frameworks like Laravel, Zend Framework, Symfony etc. I have been learning/using Laravel lately and find it requires me to constantly have to google things and read documentation for things that should be simple.
Yes, maybe you get some nice features for free but that comes with a huge cost as they basically try to cater for every use case and eventually you end up with a slow and bloated mess. A stack trace that's 70 lines deep just to load a controller, call a method, and output a response?! Come on.
I don't care for ORM's like eloquent/doctrine/etc either if it means everyone just writes queries wherever the fuck they like and there's no centralisation of business use cases. And SQL is such a beautifully designed syntax that whatever these ORM's have just feel so unintuitive and slow to read by comparison. Even if you think you might change DB one day, SQL is so standardised it's really not a big deal that it's worth the cost of abstracting all your queries away into the deep depths of the framework where no-one is really checking what it's doing half the time.
And the magic method usage everywhere... Congratulations on saving a couple of lines of boiler plate code, now the IDE doesn't understand the codebase at all.
Even templating engines like Blade/Twig feel so old fashioned these days. You can't use a debugger on them, they are so limited/clunky compared to React, and again the IDE will only have a limited understanding of it so good luck spotting errors, refactoring them etc. And don't even get me started on the insecure, laggy, inline "js" mess you will end up with Alpine+Livewire.
I even saw one of the Laravel proponents on Youtube saying how great Laravel is because they make the doccomments line up in a pretty way. Ugh.
If you have the time to learn it to a deep level, good for you, I'm sure you can be productive with it, but for me the added complexity is not worth the benefits you get back.
0
u/dutchydownunder Aug 30 '24
Why do we keep seeing posts like this? Who gives a shit? People that already like php won’t care about your 5 minute experience with php and people who hate php will not be convinced by this either.
-7
u/DT-Sodium Aug 29 '24
I'm an Angular/Symfony and I enjoy Angular far more. For starters, TypeScript is a beautiful language while PHP lacks both in esthetics and functionalities.
-1
u/iBN3qk Aug 29 '24
I’ve been stuck for a few days trying to use typescript and esm. I’m so confused, is typescript based on common js modules? Are you compiled or interpreted, make up your mind please.
0
u/[deleted] Aug 29 '24
[deleted] — view deleted comment
41
u/[deleted] Aug 29 '24 edited Aug 30 '24
[removed] — view removed comment