18 ms·
The amount of misinformation, false claims and unsupported statements in this thread is mindblowing for the quality that I've been used to see on HN. Here are
by s1k3s 6y ago
The amount of misinformation, false claims and unsupported statements in this thread is mindblowing for the quality that I've been used to see on HN.
Here are some facts:
- Symfony was the backend framework with the most contributors in 2019 [1] (yes, out of any backend framework written in any language)
- PHP has more active contributors than it ever had [2]
- Laravel is one of the most used frameworks in the world [3]
Then I see statements like "PHP only exists today because of legacies being maintained". Can't provide stats on this, but neither can the people who make these statements. Might be just because I'm a PHP dev myself but I see a lot of new projects started with the above frameworks.
And last, people compare it to languages like Rust or Go since they consider those are "innovative". I hope everyone understands that a language is fit for a certain type of task. PHP was created for website development, and in that area neither Go or Rust are even close to matching it in terms of maturity.
I may be biased but for me, choosing php for a new project is a no-brianer. The only other 2 stacks to which I can compare it are the Spring stack of Java or .NET core, and except for these two I wouldn't seriously consider any other competitor for starting a new project. Unless, of course, that project is "for fun" and you want to experiment with new technologies.
[1] https://symfony.com/blog/symfony-was-the-backend-framework-with-the-most-contributors-in-2019 https://symfony.com/blog/symfony-was-the-backend-framework-w...
[2] https://github.com/php/php-src/pulse https://github.com/php/php-src/pulse
[3] https://trends.builtwith.com/framework/Laravel https://trends.builtwith.com/framework/Laravel
- oblio 6y agoI'd assume that Django and Ruby on Rails can't be that far off.
- hnarn 6y agoWe can all assume things.
- oblio 6y agoVery polite, what can I say. Ok, I'll rephrase that: Django and RoR aren't that far off.
- deleted 6y ago[deleted]
- deleted 6y ago[deleted]
- davidwparker 6y agoNot sure why you're being downvoted. If we just look at [3] above, we see these: https://trends.builtwith.com/framework/Django-Language https://trends.builtwith.com/framework/Django-Language https://trends.builtwith.com/framework/Ruby-on-Rails https://trends.builtwith.com/framework/Ruby-on-Rails Django, at least on that site, seems to be quite far off. Rails, at least on that site, is ahead of PHP.
- tudorw 6y agoSymfony is an outstanding framework and a real pleasure to build with.
- tasuki 6y agoI've moved on from PHP some 5 years ago. I'm not missing the language. But damn I'm missing Symfony! I prefer Scala to PHP, the language is much more expressive. When you want to replace a bit of core functionality, in Symfony, you extend the desired class, add it to the dependency injection container, and you're done. In the Play framework, I once wanted to make a one-line change to the routing. When it turned out I'd have to touch 30+ files which have hardcoded dependencies on each other, I quickly gave up.
- out_of_protocol 6y agoCheck out Rails (ruby) and Phoenix (Elixir)(Rails' successor, personal favorite of mine). Many frameworks on many languages tried to mimic rails but most failed to achieve desired level of polishing/comfort/completeness/etc
- http-teapot 6y agoThis is exactly my experience as well. Moved from PHP to Scala about 6 years ago. Symfony is absolutely amazing. For example, you can import a UserBundle from github, extend the original service class, change a couple of lines and then you have a fully functional user auth system without to rewrite/wire a bunch of things. Although I don’t enjoy writing PHP anymore, I do miss how mature it is.
- piotrkubisa 6y agoThe really nice thing of Symfony framework is database schema mapping and migrations, which have compatibility with numerous database systems and provides abstraction layer [0], that among many options of interfaces have quite handy YAML-formatted schema mapping [1]. Nothing extraordinary these days but it is really stable and simple to use. [0]: https://symfony.com/doc/current/doctrine.html https://symfony.com/doc/current/doctrine.html [1]: https://www.doctrine-project.org/projects/doctrine-orm/en/2.7/reference/yaml-mapping.html https://www.doctrine-project.org/projects/doctrine-orm/en/2....
- jackofalltrades 6y agoI can't really understand the hate towards php in general, never was able to understand it. I started programming in PHP and then moved to c# and now mostly JS, but never really understood the motivations behind people bashing on PHP. Like, some of my friends that today mostly program in React/Nextjs praise the framework as something amazing and the SSR as something really innovative, and - honestly - it resembles PHP more than ever, but if you ask them about PHP they will immediately say it is a "bad language" and "a joke". Laravel, as you stated, is a really amazing framework, but some people are carrying baggage from the time of PHP4 or something even older and never really tried to see current/modern PHP and some other people just built their idea of the language around it because it was the cool thing to do.
- kangoo1707 6y agono PHP framework is similar to the thing that NextJS/Reactis doing. The output is the same (well, isn’t the point of web framework is to spit out HTML?) but the methodology is totally different.
- timw4mail 6y agoAnd about 100x more complex and fragile.
- kangoo1707 6y agoNot at all. I have worked with both for a long time and I can clearly see the differences. They are used for different purposes. The people comparing any PHP frameworks to NextJS have not been very experienced with frontend development, IMO.
- neurostimulant 6y agoNot necessarily. I recently rewrote an old web application written in php and jquery with django, react and typescript. The new application has roughly the same LoC count while having more features and better interactivity.
- 6y ago
- hnarn 6y ago> And last, people compare it to languages like Rust or Go since they consider those are "innovative". I hope everyone understands that a language is fit for a certain type of task. PHP was created for website development, and in that area neither Go or Rust are even close to matching it in terms of maturity. I'm not disagreeing with you, but "website development" is a very broad category. For example, if you definitely need a website with server-side logic and database connections, yes, that's where PHP will shine. However, if you need a more or less static website for your restaurant or portfolio, is it really as straightforward to say "PHP is for website development, write your website in PHP"? I want to be very clear that I'm differentiating between use cases here, but for something like a technical documentation website, a status page or something similar that does not require server-side logic and databases, I would much prefer using Hugo or some other type of static site generator, and not because PHP is bad but because we're still talking about "website development" but just not necessarily the kind of website that PHP was made to build. That being said, there are of course static site generators in PHP as well (and probably every other language out there), but Hugo has a special place in my heart just because of the speed of it.
- thawaway1837 6y agoFor a more or less static website, what’s probably the best bet, and has been the standard for many years, largely because it allows the non technical restaurant owner to easily update and make changes, is Wordpress. In which case you’re back again in PHP land.
- hnarn 6y agoCan you elaborate on why you would recommend Wordpress as the "best bet" for a "more or less static site"? I feel like I'm of the completely opposite opinion, that introducing something as modular and dependent as Wordpress for something "more or less static" is just asking for trouble down the line. In my mind a "more or less static website" will not require a database, it will not require logic server-side, and it will not require the possibility to add-on plugins for extra functionality. What's beautiful to me about static websites is that the threat vector is now suddenly nothing but the web server, and when you're serving static web pages that's a pretty small threat vector if you've configured it correctly. As soon as you blur the line between "web site" and "web application" and start including things like databases, forms and API:s you're in a completely different territory and I kind of feel like you should choose that because you really, really need it. Not just as a default.
- Ygg2 6y agoSo I take it all the things in this article (https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/ https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/) are no longer relevant? For example "foo"==TRUE, "foo"==0 and TRUE !=0 are logically consistent now? Or json_encode no longer returns null for invalid input?
- AegirLeet 6y agoSome of it is still true, some of it isn't true anymore and some of it simply isn't very relevant. Comparison still isn't transitive. Not very relevant in the real world because you simply don't use "==" unless you know what you're doing. json_decode still returns null on invalid input, so you either have to use the JSON_THROW_ON_ERROR option to make it throw an exception instead or use json_last_error(). Both are unfortunate, of course, but it's hard to fix mistakes made 25 years ago.
- Supermancho 6y ago> it's hard to fix mistakes made 25 years ago. I like PHP, less and less since I started with it in the 90s. Largely because of the current stewardship and syntactical changes. Many languages move forward rapidly. A difference between PHP and, say, Python is that PHP seems to move more slowly to the same end. There are still trivially fixable problems that would qualify as breaking changes. Seems lazy. Instead, we have a bunch of hand wringing because those who make the releases are heavily involved with projects that move slowly out of fear...ostensibly because they have customers they don't want to antagonize. They might jump to another framework or language.
- nucleardog 6y agoAnd for many of us, these 25 year old warts are a benefit... Rather than just "fixing" json_decode and breaking backwards compatibility, old code still works. The business doesn't care about the new shiny. When someone pays to have a simple site developed, they don't want to be paying a contractor in a year to have a bunch of stuff updated so the language it's written in is "more correct" or whatever the overriding reason is to change this. That is completely tangential to what they care about. I recently went through "modernizing" a 15 year old, 1.93 million line php 5.x app. We put in a shim for the mysql_ extension as it had been depreciated with 7.x, and fixed up maybe a dozen places where it was doing something exceptionally wacky and then tested like crazy and sent it out the door. Works fine. The business doesn't care that the code is shit. They care that it makes them a million dollars a month and no matter how gross it is there's no defensible rationale as to why they should stop doing things that make them more money for the next 2-3 years while a team goes through and rebuilds the entire thing to be "more correct". Something like pyenv/nvm/etc doesn't exist for PHP. You can just install the latest version and with very few exceptions whatever code/library/etc you find will just work. There's a lot more value in that in the real world than "fixing" json_decode.
- ptsneves 6y agoI do not do PHP and only have done a bit a long time ago, but I chuckle at the statement that nobody starts any project in PHP, only to find that a huge amount of new sites are wordpress sites, and they are a gateway to PHP. And do not discard WordPress, because it is amazing in how you can have a productive web site with no programing knowledge. After your site actually generates value then you can hire programmers to create more value. Bam, PHP to the forefront. I do asp.Net core for personal projects these days and I am so jealous of the fusion theme builders for WordPress plus the huge Eco system of plug-ins. My day job is in embedded and systems engineering, so web is not even my thing, but I find it incredible a workhorse tool like PHP gets so much disdain. Reminds me of the answers Theo de Radt, gave to the enthusiasts: nobody cares about how cool a tool is if nobody is using it. PHP is used by a lot of people, so it is more important than my new favorite darling Nim. Even if Nim sounds awesome its useless and irrelevant from a non enthusiast point of view.
- paulryanrogers 6y agoThis was said of Cobol not too long ago. Today's enthusiasts decide tomorrow's workhorses.
- _bxg1 6y agoI was paid to build a Wordpress extension once. It was the most miserable programming experience of my life. Wordpress is no doubt a powerful force on the web. As a no-code website-creation environment, it's fine. Maybe even good. But as a library, it is godawful.
- watermelon0 6y agoWhere to begin? - No proper connection pooling with circuit breakers. - No proper multithreading (that works in web environment) or parallelism in general. - Almost everything blocks (even `new PDO('mysql:...')` can block for whatever the execution time limit is, if there is an issue with connection or MySQL server). - Most libraries are implemented in C instead of in PHP, whereas with other languages people try to avoid native code as much as possible. This means that code is not memory safe, and understanding or contributing is close to impossible. The reason for this is because PHP doesn't support many things that are expected in any other language. PHP C API is hard to understand, hard to use, and documentation is subpar. - There is no way to easily share memory between processes. You have to rely on APCu (hack), because this cannot be implemented in PHP. - Did I mention that almost anything can block? ODBC? PDO? Some 3rd party library? Even set_time_limit cannot help you here. Handling this gracefully is close to impossible.
- norswap 6y agoSomething being written in C does not mean "understanding or contributing is close to impossible". That's as much of a boogeyman as I've ever seen.
- lostcolony 6y agoIt is when discussing the merits of a given language, and the assumption is "a person knows the language under discussion". I.e., for the criticism to not apply in this context, a solid PHP developer...has to also be a solid C developer. Given the context is "using PHP", the former is likely, the latter, not so likely. Exactly how likely I don't know (I don't use PHP, so don't really have an opinion anywaay), but most discussions I've seen around PHP don't also presume the adoption of C.
- alphadevx 6y agoWhere to begin indeed! > - No proper connection pooling with circuit breakers. PHP has had a "shared nothing" architecture since the very beginning, that includes DB connections. It helps it to scale (think micro-services being stateless in a modern context): nothing is shared between requests, again including connections, by design. > - No proper multithreading (that works in web environment) or parallelism in general. I once asked Rasmus about this face-to-face, during one of his presentations, specifically his thoughts about the pThread extension (https://www.php.net/manual/en/intro.pthreads.php https://www.php.net/manual/en/intro.pthreads.php), and he responded that it was not required in a web context, as web servers already have threads per request so its a mute point. > - Almost everything blocks (even `new PDO('mysql:...')` can block for whatever the execution time limit is, if there is an issue with connection or MySQL server). Well, it depends on your code of course, but pretty hard to proceed with some code that works with a DB when the connection can't be established, so proceed with what exactly other than error handling? Seems like a strange example. And as mentioned above, no (excluding optional pThreads) support for asynchronous threads in the language, so...? > - Most libraries are implemented in C instead of in PHP, whereas with other languages people try to avoid native code as much as possible. This means that code is not memory safe, and understanding or contributing is close to impossible. Ok now you have just thrown away one of the main benefits of PHP. Remember, Rasmus is a C programmer, not a PHP programmer, so he wanted to leverage that HUGE library of existing C-code from his new scripting language, from the very beginning, deliberately by design. > The reason for this is because PHP doesn't support many things that are expected in any other language. Yes it does, via the C-extensions, see above. > PHP C API is hard to understand, hard to use, and documentation is subpar. Yes programming in C is hard. > - There is no way to easily share memory between processes. You have to rely on APCu (hack), because this cannot be implemented in PHP. Deliberate design choice, "shared nothing architecture", stateless between requests, as above. > - Did I mention that almost anything can block? ODBC? PDO? Some 3rd party library? Even set_time_limit cannot help you here. Handling this gracefully is close to impossible. Yes because each request is a synchronous thread, as described above above. By design.
- gexla 6y ago> PHP only exists today because of legacies being maintained > people compare it to languages like Rust or Go since they consider those are "innovative" PHP is getting old enough for developers today to be unaware of the history of web development. If you don't know the history, then you haven't seen the twists and turns it has taken. If you don't know the twists and turns, then you don't see how everything from the past relates to the state of the present. Perhaps the greatest accomplishment of PHP is that the ecosystem so thoroughly solved a certain approach of web development that the rest of the world could move on to try these other ideas (which are of questionable effectiveness.) There's only so many web frameworks, content management systems and general web development libraries that you can build before you start to realize what waste of time it is to keep reinventing the wheel. PHP has an ecosystem which is still strong (and growing) because there's no need to recreate what PHP has done so well. Wordpress as an example is not going to be replaced. You can't replace Wordpress by building something in a different language. The code base represents mind blowing knowledge which has gone into solving such problems which have nothing to do with a specific programming language. Nobody cares that you can recreate some basic thing with the new shiny. The programming language isn't the problem. Now Wordpress is possibly reinventing the CMS with Gutenberg (like it or not) and it's not the programming language which is making it possible or hindering. PHP is a great platform to build on. As your system grows, then your problems change. The tools required to tackle those problems change as well. This is true of everything. You can't manage a Google the same way that you manage a 2 pizza team. To get to that scale, the systems need to change many times over. PHP solved a wide problem, but it's not perfect and it's not one size fits all. Go is great at solving other problems, and it's a generalist when applied to the web domain. It's not a good comparison. We haven't even started on the business side of decision making. If I want a web presence, this thread is doing nothing for me. I'm just going to fire up Wordpress and move to the next step. Or Laravel if I want a fast prototype, etc. Seeing how important this history has been in my own area of expertise makes me think I better start hitting the history books which would be important for my other areas of life. If you don't know your history, then you're handicapped when discussing the present.
- filmgirlcw 6y agoJust to interject — WordPress’ origins are indeed PHP, but most modern WordPress development, especially Gutenberg — is really JavaScript. And that’s the reality, for better or worse. Many longtime WP devs are struggling with this reality. In fact, I would posit that many of the complaints about PHP come from WordPress’s widespread usage and its slowness to adopt modern PHP features (and to be fair, I do understand that slowness. If you power such a huge portion of the web, making breaking changes to things that could impact tens of millions of sites on the name of modernization is difficult to reconcile). If/when PHP becomes just a legacy part of WordPress, it’ll be interesting to see what impact (of any) that has on the languages perception.
- echelon 6y agoPHP isn't being replaced by Rust or Go. It's being replaced by Medium, Wix, and Squarespace. At this point, the predominant reason it's still undergoing active development is that there is a metric ton of legacy PHP code. As the businesses still using it either mature, evolve, or fail, the need for PHP will begin to dry up. You're defending the language from an emotional standpoint. > choosing php for a new project is a no-brianer. The only other 2 stacks to which I can compare it are the Spring stack of Java or .NET core This is absolutely not the case, and you know it. Almost every language has a wealth of HTTP tools and frameworks, and many of them come built-in. Choosing PHP will be like choosing Python 2. In fact, that's my 2030 prediction.
- tcd 6y ago> As the businesses still using it either mature, evolve, or fail, the need for PHP will begin to dry up. People have been calling for PHP's death, or saying PHP is a dying language, for as long as the internet has been around. It's always the same arguments, that $newHipLanguage will replace it. Then you actually do some research and understand just how much of the internet is still powered by PHP and will continue to do so for the forseeable future. So, I'm still waiting for PHP's death. Or for this same predictable comment in 2030.
- echelon 6y ago> It's always the same arguments, that $newHipLanguage will replace it. It's not that a new language will replace it. It's that the people that hire PHP to solve their problem will now use a platform with no code to manage. Engineers writing platforms will choose languages other than PHP to write them. You can't spin up multiple request threads to make concurrent non-blocking queries in PHP.
- ainiriand 6y ago- You can't spin up multiple request threads to make concurrent non-blocking queries in PHP You mean that you don't know how to: https://github.com/amphp/amp https://github.com/amphp/amp
- stunt 6y agoMost of the comments against PHP are from developers that wrote PHP<5.4 long time ago as their first or second language. PHP had a bad ecosystem with lots of bad practices being a norm. There are still some issues but considering the current state of language, frameworks, libraries, and the ecosystem, it's very practical and productive environment to build any project. I've been doing Typescript, Scala, and recently also Go in last few years. Scala and Go have decent language design and I'm a fan of both of them. But, when it comes to productivity and ecosystem they don't come anywhere close to PHP. If I was about to build my own web startup, I'd definitely build it with PHP because I'm sure I could launch it 10 times faster with Laravel.
- MisterBastahrd 6y agoIt's amusing to me to see all the hate for PHP, especially when the original lazy gripe was that people hated when faced with code that was mixed with templates. So completely different than the dominant modern front-end frameworks.
- eropple 6y agoAt least one of those front-end frameworks doesn't "mix code with templates", it represents HTML as code. (It's for that reason that JSX is the first way-to-splat-HTML-out that hasn't made my skin crawl in...pretty much ever.)
- seangrogg 6y agoGP could've easily been talking about the many other libraries/frameworks that DO use templating, though: Template Syntax in Angular/Vue, Glimmer in Ember, etc.
- ivanhoe 6y agoJSX just reverses the story, it's js with islands of html tags thrown in it instead of being html with code in it... in the end when you look at an average presentation component it's still like 90% html tags and some js mixed all together...
- dgb23 6y agoI really like languages like Rust and Go and they certainly are good languages and I would love to use either on a regular basis as a freelance webdev. But with two recent projects I‘ve worked on neither would be even feasible. In one there was a requirement to generate custom designed PDFs, and in the other I had to implement authentication via SAML. Other language ecosystems that would be feasible in these cases: Nodejs, .NET, Java or Clojure because it can live in either of those. PHP doesn’t just have mature, battle tested and well documented web-frameworks. It also has libraries which do complex things that are very unattractive like PDF generation/manipulation and complicated standards like SAML.
- dzonga 6y agohave you gone through the laravel docs ?
- asdkjh345fd 6y ago>And last, people compare it to languages like Rust or Go since they consider those are "innovative" No, they do not. The entire appeal of go is that there is zero innovation at all. It is the most plain, boring, ordinary language around. It does absolutely nothing different or neat or new or special. Instead, it focus on being simple, easy and fast. Just like PHP apologists keep claiming about PHP. The difference is go was developed by competent software developers, so it isn't a broken, buggy, inconsistent mess. >PHP was created for website development And yet it is outclassed for that purpose by general purpose languages like go. >and in that area neither Go or Rust are even close to matching it in terms of maturity. Age is not maturity. PHP is old. It is less terrible than it was 20 years ago, but it is still worse that any other language except javascript.
- mtnGoat 6y agoyou are claiming the developers of PHP are incompetent? bold claim, coming from a throw away.
- piotrkubisa 6y agoIt is also worth noting the number of packages published on packagist.org [0] (kind of npmjs.com for PHP), which is rapidly growing. [0]: https://packagist.org/statistics https://packagist.org/statistics
- tjpnz 6y agoCan't speak for others but I've worked on many legacy PHP codebases over the years, it has never been a pleasant experience. Even when it's a PHP 7 codebase the same bad practices from PHP 5 and earlier are all present and accounted for. As are the subtle bugs stemming from an inconsistent standard library and PHPs approach to error handling. I'm sure that there's plenty of good PHP code out there, maybe I've just been unlucky.
- dubcanada 6y agoYa? Can't speak for others but I've worked on many legacy C++ codebases over the years, it has never been a pleasant experience. Even when it's a C++ 17 codebase the same bad practices from C++ 11 and earlier are all present and accounted for. As are the subtle bugs stemming from an inconsistent standard library and C++'s approach to verbose error handling. I'm sure that there's plenty of good C++ code out there, maybe I've just been unlucky. I can literally copy and paste what you said replacing it with any language and end up being correct. Every single language on a legacy code base will have good code and bad code. It has NOTHING to do with the language. It has to do with what the code is and who originally developed it.
- macinjosh 6y ago> I can literally copy and paste what you said replacing it with any language and end up being correct. This is the best point in this thread, IMHO. I think it also is due to the fact that PHP is a fairly easy language for a non-coder to pick up little-by-little. One can easily start using it for doing simple things, like injecting dynamic data into a web page. From there one can learn to scale up to full web apps. I think this lower barrier of entry makes a lot of developers feel insecure. A lot of coders think they are blessed with some sort of special ability to write code. They seem themselves as elite and they use elite tools. When some kid comes in with some PHP snippets and generates a lot of value from that they complain that their code sucks, the language sucks, the developers suck, blah blah. In my 20 years of writing code (starting with PHP) I have learned the lesson over and over again that while writing code commercially the fact that the language has feature X or that it forces certain patterns means almost nothing. Sure, your developers might feel better about themselves but that is about it.
- k__ 6y ago"PHP only exists today because of legacies being maintained" I think, the reason is, Facebook poured a load of money/time into PHP. Otherwise it would probably on life-support right now.
- tyingq 6y agoFB poured a ton of money into Hack/HHVM. Which didn't directly benefit PHP. I do see that it inspired the PHP team to improve, but that's indirect.
- tmh88j 6y ago> FB poured a ton of money into Hack/HHVM. Which didn't directly benefit PHP Facebook may not have directly funded PHP, but I know for sure at least one of the HHVM/Hack devs (Sara Golemon)is also a huge contributor to the PHP core. https://www.youtube.com/watch?v=TOveFBc9AyI https://www.youtube.com/watch?v=TOveFBc9AyI https://voicesoftheelephpant.com/2019/07/16/interview-with-sara-golemon-3/ https://voicesoftheelephpant.com/2019/07/16/interview-with-s...
- boredpudding 6y agoFacebook poured loads of money/time into HHVM. While I'm sure PHP also got benefits, your "Otherwise it would probably on life-support right now. " argument fits perfectly on the rest of the biased unsupported arguments.
- k__ 6y agoI used PHP in v4/5 times and had the impression development slowed down until I heard about all the "FB being bullish on PHP" announcements.
- zuppy 6y agophp 7.0 has been released 5 years ago, I think it's about time to stop using php5 as an argument for anything related to the present state.
- johnchristopher 6y agoDo you have some recommendations for books about laravel and lumen ? (I hate laracasts, I rather read than play/pause/type/play/type, etc.).
- yurishimo 6y ago"Laravel Up and Running"[0] is a popular choice. Lumen is just Laravel with a few features stripped out of the framework. They both use the same underlying packages. 0: http://shop.oreilly.com/product/0636920179467.do http://shop.oreilly.com/product/0636920179467.do
- rgbrenner 6y agoGo and Rust were designed for other things... why wouldn't you compare it to the big language that was actually designed to compete in the same space as PHP? NodeJS. Front end devs are already programming in JS, so there's less adoption cost than PHP. I can't think of a single reason to use PHP over Node (I know both, and have delivered projects in both). The comparison to .Net and Spring makes me think you might be a bit behind the curve. Have you tried Node?
- lucideer 6y agoNode developer here, but... two notes about your comment concern me a little. 1. "I can't think of a single reason to use PHP over Node" this is fine but can you think of a single reason to use Node over PHP. Is adoption cost the only one? 2. "you might be a bit behind the curve" while the original commenter was talking about PHP being "modern" and dimissing talk of it existing because of legacies, criticising someone for being "behind the curve" does smell a lot like that "must jump on every shiny new thing regardles of merit" mentality that drives a lot of the JS ecosystem. What are the material benefits of being on or ahead of the curve in this case?
- rgbrenner 6y ago1. Off the top of my head: SSR of JS apps, performance, better security track record. It also fits in the modern architecture better: you can certainly write a rest API in PHP, but that's not typically what you would use PHP for... and if you're going to write a react, vue, etc app, you're likely writing an api also. 2. This is not my attitude at all. I've been programming since the 90s.. In the past I've maintained PHP apps for years; maintained a custom web framework for 17 years; I still have sites running that use jQuery. It's certainly true the JS ecosystem has that mentality... but that does not mean every JS tool can be dismissed with that thinking. NodeJS is 11 years old... it's not a shiny new thing anymore.
- nicoburns 6y ago> you can certainly write a rest API in PHP, but that's not typically what you would use PHP for Definitely not true in my experience. lot's of people are writing REST apis in PHP. > NodeJS is 11 years old... it's not a shiny new thing anymore. I write Node stuff for work at $dayjob, and lot's of stuff is great. But it still has nothing that's close to competing with Rails/Django/Laravel in terms of completeness.
- joelbluminator 6y ago> The only other 2 stacks to which I can compare it are the Spring stack of Java or .NET core Why not Django or Rails?
- tmh88j 6y agoI've worked a lot with PHP and Java (Spring MVC & Spring Boot), and have made a few personal projects with Django. It's nowhere near as easy to get running and secure for a production environment, mainly because you have to deal with the WSGI server. There are tons of options (gunicorn, uWSGI, CherryPy, mod_wsgi if you want to go that route, etc...) and you're likely developing locally using a test server that's not suited for prod like werkzeug. PHP runs right out of the box. As long as apache is running and you have an index.php file in your www directory, it just runs. Spring Boot is a pleasure to deploy as well with embedded tomcat, it's possibly even simpler than PHP for local development because you can just give a jar to someone and it works no differently than it would in production.
- joelbluminator 6y agoidk, seems like a very narrow area to get fixated on (deployment/local development)? I do think Django is less complicated than Spring. You don't have the whole dependency injection lifecycle thing to grasp which isn't easy for someone who never seen it before. Django and PHP are closer in spirit than Spring, also due to dynamic types.
- tmh88j 6y agoI agree that Spring has a steeper learning curve than Django, but I disagree that Django is more similar to modern PHP frameworks than Spring. Django isn't MVC, it's an entirely different architecture. Symfony framework is heavily inspired by Spring [1], and modern frameworks like Laravel heavily influenced by it and extensively use its libraries. >You don't have the whole dependency injection lifecycle thing to grasp which isn't easy for someone who never seen it before. Laravel's core is built on a DI container and extensively uses that throughout. Service providers [2] are a key concept to Laravel, which requires you to directly interact with the DI container. [1] https://en.wikipedia.org/wiki/Symfony#Technical https://en.wikipedia.org/wiki/Symfony#Technical [2] https://laravel.com/docs/7.x/providers https://laravel.com/docs/7.x/providers
- greatwhitenorth 6y agoMajority of the HN commenters argue irrelevant points or are trolls and have never gone deep in any technology to be an expert and comment about it. I've seen absolutely moronic comments here. You should see the comments on 'React' or 'Java'. I'm pretty sure most have never written a "hello world" equivalent in it. It's cool to hate something popular.
- thefounder 6y agoSome of commenters are "ex" php develops. For me PHP was painfull but I didn't know that until I moved on to Ruby and now Go. I would never go back to PHP programming(i tried few years ago) just like I would not go back to Windows(except for budget or political reasons). PHP was fun back in the day because you could host it anywhere and truth be told it was an easy scripting language to learn but I don't see many reasons to use it today. Not that you can't build great products or scale it but I can no longer enjoy programming in PHP.
- greatwhitenorth 6y agoI rarely see comments like yours. You clearly mention that you used PHP a few years ago, so anyone reading your criticism will have that context and will want to try the newer version. Again, those who criticize should mention when they last used a language/framework and exactly what they didn't like about it. I've seen tomes written making fun of Javascript's type coercion when any "professional" JavaScript developer knows that the answer almost always is "strict equality".
- valand 6y agoI have similar experience. Left when it was still 5.* something. Now I mainly do TypeScript/JavaScript and some Rust on the side. To me, PHP was more of a limiter rather than painful experience (it was a bit painful though). I couldn't imagine how to even make a chat app. If not for my moving out of PHP to NodeJS now I wouldn't be a software architect and explore the rest of the fun and challenging part of computing domain.
- 6y ago
- buboard 6y agoBeing unpopular is one of the strengths of php. They rarely break stuff to make it look cool. Your 10 or 20 year old project can keep running, keep making money, allowing you to "learn the shiny stuff you ll never use"
- cheez 6y agoThe only problem I have with PHP is that it is the C++ of backend scripting languages.
- msla 6y agoHere's some interesting facts about PHP I like to know and share. How many of them are now untrue? "foo" == TRUE, and "foo" == 0, but TRUE != 0 NULL < -1, and NULL == 0 PHP sez: Parse error: syntax error, unexpected (T_PAAMAYIM_NEKUDOTAYIM)
- shakesbeard 6y agoYou may have missed it, but with PHP 7 the language has even more shifted towards stricter typing paradigms. People use strict comparison, typed properties, typed arguments, etc. Couple that with one of the popular static analysis tools and you'll never see any such errors.
- innocenat 6y agoT_PAAMAYIM_NEKUDOTAYIM was changed to T_DOUBLE_COLON ages ago
- durbatuluk 6y agoAs someone who freelance php and do on-site go coding on daily basis, modern PHP is amazing (symfony/slim is everything I want). One simple improvement I would love to see is namespace grouping in standard library. Go has all related functions inside some package. Go pls let me do http.notfound<tab/enter> = http.StatusNotFound. But in php even with inteli I need to google some function/const name.
- simion314 6y agoThere are some clueless people posting their ignorant opinions here, like some dude was hating on the guy that invented XML, sure XML might not be the best tool for everything but I can't see yaml or json to be better for documents, the thing XML was created for (but the guy probably has no idea what XML is, how it is used correctly), probably could be a good interview question to see who is inexperienced but has a giant ego and thinks he knows much.
- The_rationalist 6y ago<aside>It's great to see a sane person on HN.<aside /> What would be the strength and weaknesses of spring boot vs synfony vs laravel? Please let's not talk about the languages (kotlin, php) but more about the frameworks
- lillesvin 6y agoA lot of the common complaints about PHP are merely echoing the wildly outdated and misinformed "PHP: A fractal of bad design" that has been circulating for the better part of the last decade. Unfortunately people tend to uncritically repeat whatever it says without actually paying any mind to the facts that, 1) it's 8 years old, 2) it's flat out wrong about a lot of its claims, 3) it's evidently written by a guy who has no idea what PHP is even intended to be.
- ptx 6y agoIn regards to your last point, I believe PHP was intended to be a quick and dirty templating language for C programs. Right? But if we're not using it for that purpose anymore, why would we want a programming language that grew haphazardly out of a templating language and is suffused with the quirks of that legacy? Yes, it's better than a decade ago and getting better all the time, but is it good yet? Does it have any advantage over more coherently designed languages?
- chipotle_coyote 6y agoPHP was intended to be a quick and dirty templating language for the web, not for C programs. It was always intended to be directly embedded in HTML pages; remember, it came from the era when the assumption was that most pages were static and you only needed to embed a bit of dynamic code to make everything awesome. A natural side effect of this is that PHP programs aren't like programs in any other language: technically, they're a web framework and a templating language right out of the box, and they always start execution from ground zero at the start of an HTTP request. In some ways this is great, but in other ways it, well, isn't; implementing a front controller pattern for your MVC framework means writing code that subverts that design, as well as loading configuration and performing initialization for the entire application on every request. (Yes, I know modern PHP caches opcodes and data and I'm sure many modern frameworks are very clever about lazy loading, but no matter the cleverness they may employ, PHP frameworks simply have to do more work per request than frameworks written in languages that get all the setup and configuration out of the way once. While the criticism that the "Fractal of Bad Design" post is eight years old is fair, the criticism that the author "doesn't understand PHP" isn't; it's very clearly written by someone who understands PHP and is frustrated by it. Not all of the criticisms are still true, but PHP's huge popularity means that it's very difficult for them to change the language design in ways that truly break backward compatibility. PHP's biggest advantages, I think: - it's actually still very fast, particularly if you use a well-optimized framework or (gasp) don't use a framework at all - it's super easy to deploy, especially for small-scale sites where "first, build a Docker container" sounds like the tech equivalent of taking the Harrier jet to pop over to the grocery store - it's got a pretty robust ecosystem around it at this point In my extremely subjective opinion the closer you can come to PHP's laser-targeted ideal of "minimize the setup and just get going," the better off you are, and if you find yourself routinely invoking multiple factories to create dependencies to inject into your inflected reflected dejected container it may be time to either investigate a dynamic language that is not trying to become Java or to just, you know, use Java, but again, that's just me.
- toohotatopic 6y ago>The amount of misinformation, false claims and unsupported statements in this thread is mindblowing for the quality that I've been used to see on HN. What if the assumed quality is an illusion and every discussion is actually as misinformed as this one, you just lack the knowledge to recognize it? Which doesn't have to be a bad thing since the signal to noise ratio on hn can still be better than somewhere else. (There is actually a name for this idea, I am unfortunately unable to find it.)
- steerpike 6y agoIt's called Gellman amnesia but it's usually attributed to newspapers
- throwawaymsft 6y ago“Briefly stated, the Gell-Mann Amnesia effect is as follows. You open the newspaper to an article on some subject you know well. In Murray’s case, physics. In mine, show business. You read the article and see the journalist has absolutely no understanding of either the facts or the issues. Often, the article is so wrong it actually presents the story backward—reversing cause and effect. I call these the “wet streets cause rain” stories. Paper’s full of them. In any case, you read with exasperation or amusement the multiple errors in a story, and then turn the page to national or international affairs, and read as if the rest of the newspaper was somehow more accurate about Palestine than the baloney you just read. You turn the page, and forget what you know.” – Michael Crichton (1942-2008)
- hpoe 6y agoGell-Mann Amnesia Effect. Is the word you are looking for.
- eitland 6y ago> What if the assumed quality is an illusion and every discussion is actually as misinformed as this one, you just lack the knowledge to recognize it? That would not be the entire explanation: - I almost have bragging rights on certain topics and still find the discussions about said topics here on this site mostly good. - Other people do actually have serious bragging rights and still continue to show up, so I guess HN isn't that bad. Edit: although some of the reason for the last point could be the same as the reason why parents change diapers as pointed out a few hours or so ago: https://news.ycombinator.com/item?id=23077102 https://news.ycombinator.com/item?id=23077102 ;-)
- dzonga 6y agopeople living in the sv | start-up bubble. folks tend to forget there's dozens of websites in mainstreet that run on php. they also think everyone out there using microservices etc. nah, people just kicking dozens of laravel monoliths every part of the world. getting shit done. & getting paid. I don't use php, but I will admit the world runs on PHP, not Go, Node.js or any of the hipster shit.
- lkrubner 6y agoThe thing is, when I started using PHP in 1999, PHP had real advantages that no other eco-system offered. Regarding functionality, it had an "all in one" philosophy, whereas Perl had exactly the opposite attitude. With Perl, the first thing you had to do was research which modules you would have to download and install, but with PHP you could just start writing code. This was in the era before modern package managers, so it was a very big deal. PHP was open source, so it was a good choice relative to classic ASP. Worst of all, other languages, such as Java, were engaging in an orgy of unnecessary complexity, especially when it came to frameworks, of which Struts was perhaps the most awful exemplar. PHP was the first language to make automatic adaptations to the world of the Web, including loading $_POST and $_GET variables automatically -- some of these decisions were later seen to be huge security liabilities and so they were ended. Above all else, circa 2000 we could still rely on Moore's Law and therefore we could rely on a single CPU getting faster and faster every year. But once Moore's Law came to an end, it became increasingly important to be able to leverage concurrency, and PHP had no real story around concurrency (except the course-grained method of starting a new process). PHP 4 was a very easy language to learn. It did not have many Object Oriented features, instead it encouraged a simple style of simple functions. Ironically, when it came to objects, the default behavior was "pass by value" so PHP 4 was, in a sense, an immutable language, long before that became a popular development style (tragically, it was not optimized to manage memory in a manner that would allow ambitious use of its immutable qualities). Later, PHP developed an intense envy of languages that were seen as "enterprise ready languages". This lead to a lot of nonsense. First of all, PHP 4 was already good enough that it could be used in an enterprise, but this fact was ignored. Second of all, PHP 5 suddenly adopted a lot of Object Oriented features which added a lot of complexity to the language, but without offering the benefits that might have come from using a language like Java, such as compile time checks. I used PHP from 1999 to 2011. I built my first and second startups using mostly PHP. However, in the year 2020, I can not imagine why anyone would use PHP. It no longer offers the simplicity that it offered in 2000. It no longer offers the straightforward procedural style that it allowed in 2000. It's "all in one" philosophy is no longer an advantage because now every language has a modern package manager that makes it easy to include whatever is needed. Nowadays, with Javascript, you just type "npm install" and you get every module that you need. And yet PHP still doesn't offer some of what a complex language like Java or C# might offer, especially regarding strict typing or compile time checks or run time efficiency, or a separate set of runtime flags for a compiled version. PHP has become a weird mutant, imitating the more complex languages but without offering their benefits. And crucially, the other languages have not been stagnant. The community around Java eventually gave up on Struts and started developing light-weight frameworks that made development much easier. And there sprang up dozens of languages that run on the JVM and which offer a wealth of good ideas about how to do modern development. (I became a huge fan of Clojure.) I seriously can not imagine why anyone would use PHP now. It no longer offers simplicity, but developers don't gain much from all the extra complexity that's been added. [Added] A final point: this article makes it seem like Composer is something of a victory for PHP: now PHP has a modern package manager just like all the other languages. But this strikes me as a defeat rather than a victory. Circa 2000 I loved PHP because of its "all in one" philosophy. If that style of automatic inclusion is no longer possible for PHP, and therefore PHP needs to become just like all the other languages out there, how does that reflect well on PHP? One more unique strength that PHP once had is now gone.
- whycombagator 6y ago> The only other 2 stacks to which I can compare it are the Spring stack of Java or .NET core, and except for these two I wouldn't seriously consider any other competitor for starting a new project Surely Django & Rails are also comparable to something like Laravel?
- pdimitar 6y agoYou claim "misinformation, false claims and unsupported statements" while you yourself only appeal to popularity and habit. Those are not directly correlated to quality. It simply means that PHP in the eyes of the businessmen is the safer choice due to a much bigger hiring pool. The popularity and adoption have a snowballing effect; once a certain critical mass is achieved then the whole thing sustains itself. Every reasonable programmer will agree with you that different languages serve different niches. Nowadays however there are several mature and solid web frameworks in other languages, thus PHP is very far from the only -- or the best -- contender in this area. And yes, you are biased. That's quite okay. I can also make a ton of smaller projects in 2-3 days with Elixir's Phoenix -- some that have a smaller scope I can also do with Rust's Rocket even. But I don't claim they are the "no-brainer" choice. You should not too. Finally, implying that choosing anything other than PHP makes the project a "for fun" endeavour is disrespectful and does not do your argument any favours.