5 ms·
This may not be directly apparent to "typical" HN crowd, but PHP is having a quiet renaissance, thanks in part to a standardization of tools and processes, a mo
by fevangelou 4y ago
This may not be directly apparent to "typical" HN crowd, but PHP is having a quiet renaissance, thanks in part to a standardization of tools and processes, a more mature ecosystem (Laravel has been a huge factor here) plus the performance improvements since PHP 7.
Kudos to the folks who built Castopod.
- actuallymaybe 4y agoAny good summaries of what's been happening or background on the renaissance, I used to do some PHP. Mainly Python now, but PHP even in its old incarnation I had a sort of love for its idiosyncrasies Also likewise to the team, kudos to the people who built Castopod
- deepstack 4y agoBeing use PHP when it was Personal Home Page, also dropped out since PHP5 to node and now deno. Wonder what changed in 7 that makes it worth at look again now days.
- jacobyoder 4y ago7 brought a huge speed boost. (typically 100% or more without any code change required). Not specific to 7, but 2 things I think have helped a lot are: * PSR standards * composer packaging Initial PSR work helped define some package interop standards. I'm not sure how useful ongoing PSR work today is (no doubt there's some incremental benefits?). Composer is a great package manager, and helped usher in a lot more sharing/reusability of common components. Laravel bundles a number of Symfony components, for example (many frameworks do). The speed alone in 7 was big, and we've seen some more incremental improvments in 8 and 8.1 and 8.2. It's hard to find current benchmarking tools that compare the 5 series with 7 and 8. I found one showing 5->7 on a mandelbrot run. * PHP 5.0 was 251s * PHP 5.1 was 87s * PHP 5.6 was 29s * PHP 7.0 was 15s * PHP 7.1 was 9s The 'experimental JIT' work (at that time) yielded 4s. That benchmark was from 2016, so... way out of date now, but other numbers I've seen were 7.1->7.4 was another ... 10% improvement on average, and depending on workload, you might see another 10-20% improvement from 7.4->8.0. Kinsta has some interesting useful benchmarks on 'real world' apps https://kinsta.com/blog/php-benchmarks https://kinsta.com/blog/php-benchmarks Been using PHP since 1996, and ecosystem, community, performance all continuously improve year over year.
- obituary_latte 4y agoWow, that's pretty impressive especially with no code changes! Thanks for the breakdown and for sharing!
- jacobyoder 4y agoYou're welcome. Much of the speed bump in 7 came from reworking internal memory usage and allocation. A pointer for an array entry used to be 128 bytes - each array entry had a 128 byte overhead. It was reworked and refactored down to... 42? or 44? You can probably imagine the impact that might have on memory allocation.
- fevangelou 4y agoOTOH, I'd say language changes/improvements, PSR, the tooling of course (Composer/Packagist, tons of CLI tools), the frameworks (Laravel or Symfony, with CakePHP & CodeIgniter still rocking, also micro-frameworks like Slim/Lumen), the libraries (Symfony components, FriendsOfPHP, thephpleague.com), debugging (PHPStan, Phan, Psalm, PHP Insights), refactoring (PHP CS Fixer, PHP_CodeSniffer, Rector), async/event driven (Open Swoole, ReactPHP). On Linux, production multi-PHP deployment is dead-simple thanks to the excellent DEB.SURY.ORG (for DEB based distros) and REMI (for RPM based distros) repos. It's also more common to deploy PHP via PHP-FPM and Nginx nowadays. Homebrew does a decent job on macOS too, multi-PHP deployment is also easy when coupled with Nginx/PHP-FPM. For Windows I have no idea but as long as you got XAMPP and MAMP, well :) Lots of Docker based solutions too like LocalWP (not just for WP), Lando, Laragon, DDEV to name a few. There's also excellent support in editors/IDEs, either by default (in JetBrain's PHPStorm, Nova, KDevelop or Kate Editor) or via plugins for VSCode, Sublime Text, Atom and others.
- rodrigodlu 4y agoDefinitely. I ran away years ago (before the facebook boom) from PHP because of Ruby on Rails. I was a happy camper for several years using RoR. Now seeing Laravel rebuilding the entire PHP ecosystem with a highly collaborative community, standard practices and tools is amazing! Too bad I'm not investing in web dev anymore.
- marginalia_nu 4y agoI think the sticking power of languages like PHP, Java and the like are chronically underestimated. They may not be growing as fast as ${LANGUAGE}, but they sure aren't going away either. The benefit of having a stable and mature ecosystem to can't be overstated. You can probably in general estimate the expected lifetime of a language to be at twice as long as it has currently existed.
- jermaustin1 4y agoas an ASP Classic then ASP.Net developer of nearly 20 years, I know I've never wanted for a job/gig/contract/whatever. C# and ASP.Net aren't sexy, but they are staples in the corporate world.
- urbandw311er 4y agoI came here to say exactly the same. They've survived, they're dependable, increasingly portable and likely to still be here in another 20 years.
- 9dev 4y agoIt’s just a pity it has to be Laravel, which is riddled with magic, bad practices, hardly - if at all - typed code, and little inefficiencies everywhere you care to take a look. Compared to Symfony, it’s a dirty, steaming, mess. That’s not to say you can’t build great things on Laravel, and it’s undeniably sparking lots of creativity - I just wish the better competitor had won. Betamax all over again.
- codegeek 4y agoSymfony may be technically better but Laravel won because Taylor is a genius at creating a community and I personally feel that the "magic" of Laravel is what made it easier for devs that needed lower barrier to entry. Then an entire ecosystem was created like "laravel Forge" (to manage servers) and many others including even serverless PHP using Laravel Vapor. Lately though, I am beginning to get annoyed with Laravel due to way too many breaking changes with major releases literally within months and definitely a bit exhausted trying to keep up. I understand they are going full scale modernized approach but after Laravel 6, it has been too many major releases.
- tomschwiha 4y agoDid Laravel really win? If you use Laravel you will install Symfony components: https://symfony.com/projects/laravel https://symfony.com/projects/laravel https://github.com/laravel/framework/blob/9.x/composer.json https://github.com/laravel/framework/blob/9.x/composer.json
- codegeek 4y agoI am aware of that as we use Laravel heavily at my company. It depends on how you define "win". Laravel won as in getting the adoption by developers due to its ecosystem and low barrier to entry. Symfony is more component based (powerful) but you need to put it all together which is a bit more work. I personally love Symfony even though it was a lot easier to start and go to market with Laravel.
- 4y ago
- codegeek 4y agoIs this project in Laravel though ? I checked composer.json and unless I am losing my mind, I see "Codeigniter" in there. https://code.castopod.org/adaures/castopod/-/blob/develop/composer.json#L10 https://code.castopod.org/adaures/castopod/-/blob/develop/co...
- jayknight 4y agoI think the parent is just saying that Laravel has a lot to do with PHP's renaissance. Codeigniter 4 was a complete rewrite to bring it up to modern PHP standards. I haven't used it, but I hear it's quite good.
- jjice 4y agoIt is having quite the renaissance. Unfortunately, a lot of long standing PHP code bases remain vanilla with globals everywhere are bad practices. Nothing wrong with vanilla PHP, but it really starts to limit what you can get done when you have a very transaction script[1] oriented code base and there are no good abstractions and layers. I'd say the issue isn't PHP (8.1 is actually packing a ton of awesome features), but more so old PHP programming practices that are still very prevalent. [1] https://martinfowler.com/eaaCatalog/transactionScript.html https://martinfowler.com/eaaCatalog/transactionScript.html
- freedomben 4y agoThis is a lot of what I'm seeing. You can write a nice, pleasant application with laravelle, but so many of the existing PHP developers don't write code like that. They use the horrible practices that they started with. I don't know how the PHP community is going to overcome this, and failure to will hurt adoption.
- tehbeard 4y agoI mean, the same is true of javascript, part and parcel of having a low barrier to entry is that people who put low effort into their work can use it... As to how we're sorting that; pretty much the only major project I can think of that I'd describe as "actively legacy" in its codebase/style is WordPress, and that's a hairy discussion around moving forward vs. backwards compatibility of their plugin/theme ecosystem which is their primary USP. Practically every other serious project has moved to the composer/PSR-4 autoloading model, and a lot of them also make use of static analysis/linting tools to squash potential bugs and enforce standards. If you're a web dev company that values maintainable code you can weed out these legacy slapdashers in recruiting. And those legacy projects out in the wild? Not my concern until someone brings one to us saying they want x feature added, we point out the Y,Z and Q faults / security issues with their slapdash code, and negotiate a price on a sane rebuild that'll be maintainable going forward. It may be a bit of mess, but it's being made better little by little each day, and the naysayers can complain about PHP all they want, I'm still getting paid to write PHP.
- 4y ago
- danielvaughn 4y agoI didn't know about this until a while back, I was at a meetup. Casually talking to other JS developers, I mentioned off-hand how I had written PHP was back in like 2010-2012. Started talking shit about the language and a guy behind me called me out and went on a long spiel about how great it has become. Now that file-based routing is making a comeback (https://enhance.dev https://enhance.dev), it would be interesting (and hilarious) to see it come full circle and we all go back to writing SSR with PHP.
- Cyberdog 4y ago> go back to writing SSR with PHP. Hello. I'm someone that never stopped. Been paying my bills with PHP for fifteen years, and as PHP has gotten better and better I haven't regretted a minute of it.
- danielvaughn 4y agoI mean en masse, to the point that a significant percentage of new projects decide to go with that tech stack.
- fevangelou 4y agoSure, spaghetti React/JSX code coupled with SSR is the new hotness :D For Node/JS folks, we've had "PSX" for decades in PHP: <?php function render($html) { return <<< PSXRULEZ Look ma, it's pure $html! PSXRULEZ;
- lakomen 4y agoI abandoned PHP in 2013 for Go. Never looked back. Sometimes I have to fix PHP code, I hate it every time. I can't take PHP seriously. When ever I see a project advertised that's written in PHP I never consider it. It's like spam mails. Performance matters and PHP doesn't perform, not compared to Go. That's one reason, the other was the absolute stupidity of the PHP crowd. Their new dogma and wrong paradigms applied to the language. Symfony is god awful, it's slow to develop with, performs awfully, dependency hell, overly complicated without reason. I had to rewrite 3 sites, 1 is still left to do, in Go because there is no upgrade path to current versions. Major security issues. Do I have to run PHP7.3 with manual fixes and Symfony 2.3. I can't upgrade, I have to rewrite from scratch, and because of that I'm doing it with Go. Worst decision ever to use Symfony. And the arrogance of this Stof guy, stubborn but full of himself. And his work had so many security issues. The whole OO fetish back in 2013 with Java methodology with the sheep crowd killed PHP for me. I actually loved the language for its simplicity, I came from C++ in 2001 and loved it. In 2010-2013 it became a monster. Clueless students repeating stuff they learned somewhere, stupid people really
- dubcanada 4y agoI think Symfony has contributed more (HTTP Framework, etc), but Laravel is certainly a massive part.