5 ms·
The Future of PHP
- thomasedwards 7y agoI’ll save you the bother of reading 966 words: No, it’s not. To me, it’s never been a better time for PHP.
- rogem002 7y agoRecently I was asked to help out with a PHP project for work, I made the switch to rails almost a decade ago & haven’t looked back since so I was excited to see how PHP felt. I was fairly impressed with how easy it was to jump back to PHP, the documentation is full of examples, there is composer for package management and it has a strong community who meets up regularly.
- downtide 7y agoExactly. Composer is key here. Pear just didn't work well as a third party bolt on. As a result monolithic frameworks such as Zend Framework were born, along with Blogs, come CMS come frameworks. And Rails clones. It's still hard to navigate the 3rd party landscape, but integration is so much easier. My main gripe with Php is editor support. Jumping around a code base is hard when you introduce slightly abstract class loading. The more 'typed' the language is, I guess makes editor help easier, with auto completion etc. But that is a disjoint or me. Editor support for functions is useful. I'm slightly embarassed still at the frequency of my manual lookups. Class autoloading is nice, but functions are left by the wayside on the autoloading front, which is a bit gnarly. The language is actually quite quick to learn, and you can hold a lot in your head. You can do a lot just with arrays and foreachs, without having to reach into convenience functions. Most of my time is laboured over other frameworks and interoperability, rather than any really worry about Php itself.
- LeonM 7y ago> My main gripe with Php is editor support. Jumping around a code base is hard when you introduce slightly abstract class loading. The more 'typed' the language is, I guess makes editor help easier, with auto completion etc. But that is a disjoint or me. If you are comfortable with IDEs, I strongly recommend PHPStorm. It is the one piece of software that I happily pay for each year. It increases my productivity and quality control to such degree that I wouldn't want to write PHP code without it. > Editor support for functions is useful. I'm slightly embarassed still at the frequency of my manual lookups. I've been writing PHP for 10 years now, and I still have to look up just about every function. I only recently discovered that PHPStorm supports displaying the PHP manual as you type, but that it is disabled by default.
- maitredusoi 7y agoFor me PHP is exactly like IE6, it completly shaped web programming as we know it, and will have a true resilience, before dying, inevitably (disclamer: I used PHP from 2000 to 2009 , then switched to rails on a daily bases).
- thomasedwards 7y agoYou may want to take a look at Laravel.
- maitredusoi 7y agoSorry, I did. I made a quick return to PHP in 2016, being so happy to try Laravel on a real big project. So ... just pure disappointment ;( ;( It is 4 time more verbose than rails and not fully compliant. Laravel is purefect for people knowing only PHP, it is a real nightmare for rubyist. ;(
- VvR-Ox 7y agoAnd when you understood how it works you may want to try Symfony. Laravel also uses some of their libraries.
- bennyp101 7y agoNo. As much as everybody likes to hate on PHP, it powers a lot of services that are used all around the world - and a lot of internal systems. With 7.3 it seems as though PHP has finally got to a point where it knows who it is and where it's going - don't get me wrong, it's paid my wage for the last 18 years - but it's also made it very easy to shoot myself in the foot. With frameworks like Laravel and Symfony about now, I can only see it getting stronger. (Although I'm moving to more Elixir and Phoenix, I still pick PHP for simple projects, or those that I can't use Elixir on - and obviously maintaining and upgrading existing things)
- jjeaff 7y agoEven if php stopped being used in all new projects today, people are still hiring for cobol projects. The number of php projects now is orders of magnitude more than cobol in it's heyday. There are going to be plenty of php jobs for quite some time.
- jarfil 7y agoProbably true, but also COBOL usually encodes the business logic, which is much harder to throw away and rewrite from scratch, than any presentation layer written in PHP.
- deragon 7y ago>With 7.3 it seems as though PHP has finally got to a point where it knows who it is and where it's going I've been reading a similar sentence for each version since 5.6. Is 2020 also gonna be the year of the Linux desktop?
- 3stadt 7y ago> Is 2020 also gonna be the year of the Linux desktop? Of course. Every year is the year of the Linux desktop! :D
- deanclatworthy 7y agoIt’s exhausting seeing these kinds of discussions. The only people who think PHP is dying is those who don’t use it. Besides the languages quirks, it’s incredibly productive and has a huge community of well engineered libraries for almost all mundane tasks. Theres great testing tools and general quality tool alike PHPStan. There’s an enormous pool of talent to hire from. I code mostly in node nowadays, not through choice but due to the language snobbery I encountered during the last few years. It’s a shame. I find myself far more productive in the synchronous model than trying to bend my mind backwards with closures and async issues in the node world.
- thinkindie 7y agoThere are other languages receiving way more praises like Python that at the end of the day are just lacking so many features that php gets right but still php is the bad guy.
- deragon 7y agoLike what features?
- thinkindie 7y agotypes? interfaces?
- deragon 7y agoTypes, sure. PHP 7 does those better than python, mainly due to the fact that the main implementation actually checks the types. Python seems to rely on 3rd party tools for that for some reason. Dunno if they're gonna change that or if they designed it like that. Interfaces, hmm. PHP took its whole OO almost directly from Java, which is an odd thing to do given how different the typing disciplines of Java and PHP are. Python's OO system is much more in-tune with the dynamic aspect of the language.
- 7y ago
- Isinlor 7y agoIt's like Quora.com: - Is PHP dying in 2019? (25 Oct 2018) - Is PHP dying in 2018? (27 Apr 2018) - Will PHP die out in 2017? (24 Mar 2017) - When will PHP finally die? (13 Feb 2017) I asked people at Metaculus (a forecasting website) "When will PHP die?". The current consensus out of 43 predictions seems to be 50% chance before Jan 2037, 75% before Feb 2051. Seems like a reasonable prediction. If you are interested in making your own predictions: https://www.metaculus.com/questions/1691/when-will-php-die/ https://www.metaculus.com/questions/1691/when-will-php-die/
- reustle 7y agoAccording to this interesting Google Trends chart https://trends.google.com/trends/explore?date=all&q=python,php,ruby,javascript https://trends.google.com/trends/explore?date=all&q=python,p... Python is on a quite strong climb, with PHP falling significantly over the years. But, it also says Javascript is on the same trajectory so that shows the real value of the data.
- hotgeart 7y agoThe chart isn't interesting. You don't know if ppl who types python, typed it to make websites. Same with Javascript, you can do an entire website but also an native apps or just a modal.
- rokalakt1337 7y agoThere are many fresh graduates coming out of uni thinking Python is the next big thing. But once they realise companies don't want to invest in re-inventing the wheel, they will one way or another have to learn some PHP.
- krapp 7y agoIf effing C and COBOL are still around and Javascript somehow turned popular as a general purpose application language then PHP isn't going anywhere.
- valand 7y agoC is coming back. Seeing rust is rising and its interoperability with C is pretty nice. JS is almost general purpose these day. Just a bit more push to optimizations on JS engines.
- jonplackett 7y agoThis whole article reads like a search engine optimisation piece.
- valand 7y agoUpvoted because 1. you're funny and 2. it's true
- Paturages 7y agoCurious on how much of the 34% actually uses PHP >= 7. As long as there's legacy, PHP jobs are not going to run out for sure, that's a given. I wouldn't exactly mind carrying a project in PHP >= 7, but I wouldn't wish to get a job in PHP < 7 territory personally.
- Isinlor 7y agoIn May 2018 78% of Composer users were on PHP 7+. (Composer is the PHP package manager.) Source: https://seld.be/notes/php-versions-stats-2018-1-edition https://seld.be/notes/php-versions-stats-2018-1-edition
- mpol 7y agoLooking at the WordPress statistics, about 60% of WordPress websites runs on 7.x. I can imagine for dedicated servers that run PHP frameworks, that percentage is higher. https://wordpress.org/about/stats/ https://wordpress.org/about/stats/
- joelbluminator 7y agoRails developer based in the Netherlands. I wish there were 50% as many Ruby/Rails jobs as there were PHP jobs here, mainland Europe is crazy about PHP for some reason.
- nallerooth 7y agoI've been really impressed by the performance improvements made during the last couple of years. I guess my main issues with the language is the non-uniform naming of functions and the ordering of their parameters. At some point, I'd like to see a new major release that deprecates all of those old problems in order to clean stuff up. Even if it means breaking backwards compatibility a year or two later on. It turns out, however, that such things aren't easy to handle. Python 2 to 3, anyone?
- fetbaffe 7y agoDifferences in naming & parameter order for the PHP standard library functions are because they are usually just a thin layer above a C library, therefore are consistent for that C library (e.g. string functions), but not between libraries. Would it really make sense for PHP to standardize between C libraries?
- nodex-alex 7y agoYet another reason I don't subscribe to Medium Medium wanted to charge me for that advertiorial crap by means of a subscription.
- firasd 7y agoAs far as prominent products, besides WordPress, Facebook, and Wikipedia, Slack and Mailchimp are (were?) also PHP. (I googled and apparently a prominent '-hub' site uses it too.) The PHP hate never made sense to me in the context of the rise of Node.js: * In PHP I've never accidentally combined 2 + 0.3 into 20.3 * I dislike the cowboy-ish over-use of ternary operators and short-circuiting by JS devs (random example from StackOverflow: var bar = data.bar !== undefined ? data.bar : 'default'; ) I appreciate that JS has functional-programming aspects that make it appealing though. It's interesting that when PHP alternatives like Rails came around I saw a lot of anti-Java sentiment online, but now when Rails-based companies have to scale they end up using Java or JVM-based infrastructure. So trendy online sentiment shouldn't really inform best practices for various teams at various stages. (I notice that a lot of NoSQL hype seems to have died down since 2015...) Perhaps the best commentary about why people succeed with PHP is this HN comment from a couple years ago: https://news.ycombinator.com/item?id=12704094 https://news.ycombinator.com/item?id=12704094 If you're programming in PHP, you're not running around talking about "convention over configuration" giving talks, or trying to make your code beautiful... You're incorporating feedback while the other guy is just starting to get to work. When he finally fails, he's used up half his runway, whereas you, the guy who didn't give a fuck about your code has gotten past that first failure, and are finally getting some traction.
- dijit 7y agoas my friends will attest, I'm not the largest fan of PHP. But it's not the language it was, it's much better these days; and it was always very fast for an interpreted language. I really cannot agree with you more that for all the hate PHP gets, javascript is a thousand times worse. I figure the major difference is the ecosystem surrounding javascript. The tools are super great and writing multi-threaded/async code is very easy. But I say this as a person who avoids both PHP and Javascript, so I might be talking nonsense.
- wildduck 7y agoI have being using PHP since it was call PHP - Personal Home Page. The best part of the PHP is the templating! It makes a lot more sense then Perl at the time. Now days templating can easily be replaced by EJS. Personally I wouldn't want to use any language that does not have closure and function as a first class citizen. It makes programming fun and productive. BTW, the 2 + 0.3 thing you are mentioning are all fixed by ES15 and ES6.
- gerardnll 7y agoI feel like I see this topic pop up every few months, pretty tired, and the article itself doesn't offer anything new or worthy data... I feel that PHP is here to stay and future releases like 7.4 and 8 are going in the good direction. I'm pretty happy with the health of the ecosystem and how the language has improved over the last years.
- pavlik_enemy 7y agoIt’s not dead but there’s no point in learning it if you don’t know it already. Pretty much every language used for web development is better than PHP. Python is more consistent and has better support for async code. JavaScript can be used on backend, web and mobile, Java and C# are faster and have better typing
- thinkindie 7y agoJavascript better than PHP - I doubt. There are several solution for having Node.js style PHP too and they are doing great, see reactphp and alike
- laurent123456 7y agoI'm not sure I'll start a new project using PHP these days (though the latest Symfony is very good), however I still frequently uses it as a scripting language, as an alternative to Bash. It's perfect for this, easy to use, and can scale to large scripts if needed.
- tannhaeuser 7y agoI'm hearing a lot of praise for PHP frameworks such as Laravel, but I'm not sure PHP should strive to become more like RoR and Node.js. Rather, PHP's unique selling point, for me anyway, is its use as embedded language in otherwise static HTML pages via SGMLish processing instructions (`<?php ...>`), and I think there's nothing wrong with that even with the current preference towards Ajax and (micro)services. It's just that embedded PHP did such an incredibly poor job (like, not even an attempt) of preventing injection attacks despite SGML having very strong mechanisms for context-dependent escaping and markup validation. Which has given PHP its bad rep as a botnet/DDOS vector, and deservedly so since this has become a long-standing problem for PHP and non-PHP sites alike.
- Isinlor 7y agoMixing PHP, SQL and HTML is ok for 200 lines apps. It does not scale to even 10 000+ lines of code and no one is doing that anymore. Some people are still using PHP just as a template language, but there are still issues with XSS, that one could avoid by default with dedicated template languages like Twig. Current main selling point of PHP are great frameworks and ecosystems, easy to find developers, and share nothing architecture that removes whole class of problems related to memory leaks and scalability.
- dpau 7y agoLike many I've worked in lots of languages over the years and enjoyed the benefits, challenges and quirks of each one. But when I want to get a web application idea up and running I almost always reach for Laravel. It's the cleanest and most feature-rich application framework I've come across. I don't really care that it's written in PHP. All I know is that it's rock solid and gives me tons of infrastructure built-in. (I should note, though, that for the past couple years I only use Laravel for the back-end, and Vue for the interface.)
- tylerjwilk00 7y agoYou either die a hero, or you live long enough to see yourself become the villain. ~ Batman