6 ms·
Ask HN: What PHP framework would you choose if you could start over?
Suppose you work at a company and a new project comes up with no reponsibility whatsoever to reuse existing code. The task is to create a web application based on a framework with the following features:
- GPL-compatible licence
- developed by community, not a company
- framework and application are written in PHP
- should be extendable via plugins/addons/extensions etc.
- cms features are included (or via addons)
- deployment features are included
- no php code in templates
- payment and shop features are included (or via addons)
What framework would you choose?
Also, feel free to share experience with web frameworks even if you don't know any framework that might fit.
- dre85 10y agoI use Symfony and love it.
- uptown 10y agoLaravel It's got the most active PHP community, and sufficient online support from documentation and community. You could also start with Spark and let them handle the boilerplate. https://spark.laravel.com/ https://spark.laravel.com/
- kluck 10y agoDoes it match _all_ the criteria above?
- vacri 10y agohttp://lmgtfy.com/?q=laravel http://lmgtfy.com/?q=laravel
- joshstrange 10y agoWow.... What a sense of entitlement. You ask HN a question and then jump down a commenters throat for potentially not meeting ALL of your requirements (Some of which are not clear at all or, at least with the information you provided, don't make sense at all: templates without code in them aren't templates, they are static HTML pages...). Laravel is a great suggestion and has been made multiple times in this thread, it may not meet every last bit of your criteria but to disqualify it for that reason would be ridiculous. There is literally NO framework or CMS that exists that is going to meet _all_ your requirements.
- kluck 10y agoMy comment was not meant to "jump down" on anyone. Sorry for the misunderstanding. It was a simple question (also because the Laravel answer did not go into that much detail). The reason why I added "templates without code" is because I have seen too much abuse of php code in templates to even consider doing that again. While you are probably right that there might not be (but who knows for sure...) one framework that meets all the criteria, it is still worthwhile to ask the community for suggestions.
- JeremyBanks 10y agoDjango
- Finnucane 10y agoBSD license, not GPL.
- mikeokner 10y agoBSD 3-clause is GPL-compatible. https://www.gnu.org/licenses/license-list.html#ModifiedBSD https://www.gnu.org/licenses/license-list.html#ModifiedBSD
- Jean-Philipe 10y agoThe framework's language should be PHP, not Python.
- gondo 10y agonot really a PHP framework
- Daviey 10y agoAnd that is exactly why it is perfect. I would never prefer a PHP framework over Python / Ruby.
- Juliate 10y agoWhat's the scope/role/purpose of your app?
- kluck 10y agoResponsive UI for non-web system. But noone knows what the future brings so we'd rather build this thing on a solid base.
- accnt 10y agoLaravel I believe matches most criteria above. Symfony would be a second choice. The driven factor though is community. This is key. No matter how good your framework is if there is no community behind it to create, innovate, talk about it and so on. Worked with Zend framework 2, which I believe is a great PHP framework, but the community is stagnant. We often have to create modules (libraries) for things most frameworks already had (ie, Symfony).
- tangue 10y ago* - developed by community, not a company * This rules out Symfony and Laravel which are imho the only sane options in php. Why do you need this requirement ?
- jonursenbach 10y agoLaravel isn't developed by a company.
- mikelbring 10y agoLaravel LLC
- conradk 10y agoActually, Symfony has corporate backing with SensioLabs, if that's the company you are referring to, but Symfony is also largely developed by the developer community. You can submit patches, feature additions and they can be merged if there is a consensus on the quality and usefulness of the patch. I think Laravel has the same development model.
- rafaquintanilha 10y agoI guess he's meant an open source solution, which both Laravel and Symfony are.
- kluck 10y agoThis ensures that the development of the framework is not guided by commercial interests.
- jordanlev 10y agoAs someone with positive experience in Ruby on Rails, I would choose (and have chosen) Laravel. Specifically version 5.1 which is the current LTS release. It does not have a CMS module nor an ecommerce add on as far as I'm aware, but depending on the complexity of your requirements they might not be difficult to do yourself (eg just a few pages of editable content with a few wysiwyg editors here and there, and a straightforward shopping cart / checkout experience using Stripe for payment). If you absolutely need plugins for all the things in your list, I think Symfony is probably your best bet -- but it is less of a cohesive framework than Laravel, so you'll be mixing and matching things and doing a bit more work on your end (but possibly worth the tradeoff).
- shivakaush 10y ago> It does not have a CMS module octobercms.com is based on Laravel
- jordanlev 10y agoOctober is based on Laravel, but it is not a module that you can "plug in" to an existing Laravel site -- hence it does not meet the OP's requirements.
- prophet_ 10y agoSilex
- conradk 10y agoI would choose Symfony. I believe it matches all of the above criteria. And it has: - amazingly simple upgrade paths, backwards compatibility guarantee on minor and patch releases - regular, non BC breaking, updates and new features - corporate backing - large ecosystem of "bundles", which are Symfony's addon system - cli tool for scaffolding, debugging and more - strong conventions that help keep code structure clean when you are in a team of 2+ members
- preinheimer 10y agoSlim - http://www.slimframework.com/ http://www.slimframework.com/
- stupang 10y agoCode Igniter and Drupal are my choices.
- tumurinn 10y agoWorked on Drupal for half year and I swear that I will never touch this piece of shit. CodeIgniter is only good for very simple website. It miss a lot of functions that a sophisticated framework has (eg Laravel)
- busterarm 10y agoDrupal, in whichever flavors people are still using (5, 6, 7 or 8) is quite bad. Avoid, Avoid, Avoid.
- arippberger 10y agoI'd argue Laravel and Symfony's development are tightly coupled to a single person / company (Taylor Otwell / SensioLabs). If CMS & ecommerce are a big portion of this project I'd easily pick WordPress. The only requirement it fails to meet is "no php code in templates". WordPress meets all the other criteria and it is generally great for spinning up a MVP.
- gremlinsinc 10y agoWordpress is good if you need posts/blog-like site, but if you're going to scale up to something really huge like Groupon did, you'd be better off with a custom framework w/ full control, better caching, etc. -- Wordpress is a hog on resources, and very easily hacked as well. My laravel sites all perform light years better/faster.
- KayL 10y agoDepending on projects I'd choose between Laravel & WordPress. I like the simplicity of these 2 systems.
- vansteen 10y agoSymfony 3 or Laravel 5. Laravel has been created by Taylor Otwell. Here are his thoughts on Symfony 2 "vs" Laravel 4. It's from 2013 but it's still interesting to understand the difference. https://www.reddit.com/r/PHP/comments/1bdln1/symfony2_vs_laravel/c96ohf1 https://www.reddit.com/r/PHP/comments/1bdln1/symfony2_vs_lar...
- 3ds 10y agoI realize that this is not in line with the PHP requirement, but hear me out: I would use Ruby on Rails. I have transitioned from using Drupal to Symfony2 (sometimes with Sonata) to using Ruby on Rails, and let me tell you, everything is indeed greener on this side. The tools are better, the language is easy to learn and it is mostly sane. The framework is amazeballs, I am not even kidding. Writing tests is actually fun. In general, I am a much happier developer with Ruby on Rails. I would also dare to say that RoR makes me a lot more efficient as well. In Symfony I'd frequently get stuck in finding a workaround for some weird bug, which just doesn't happen that much anymore in Rails...
- busterarm 10y agoI have to agree. Having gone from using Ruby/Rails to the PHP side and its whole ecosystem, if you want an MVC framework I would say just use Rails or Django. Laravel is somewhat painful by comparison. Wordpress is quite fine for most things though.
- justinph 10y agoLaravel or Slim.
- amansh29894 10y agoyes it is really good to use this
- oneweekwonder 10y agoYii2[0] is simple, elegant and powerful. Unfortunately it does not adhere to: > - no php code in templates But it does abstract the template/view nicely. On a personal note and this will most probably get me down votes. I would not recommend anyone to use PHP frameworks. But I understand real-life factors like current skill set, dev availability, etc. [0]: https://github.com/yiisoft/yii2 https://github.com/yiisoft/yii2
- rdoherty 10y agoI agree, and I've used Laravel too. Yii is built and designed by someone who has written frameworks before and understands how to do it right. The creator wrote the Prado framework, then wrote Yii from the ground up. Laravel definitely has all the hype, but Yii has been around much longer and is better architected imho. It does have a slightly steeper learning curve and isn't as instantaneously easy to use at first, but it's worth the effort.
- emilsedgh 10y agoI would not recommend anyone to use PHP frameworks. I haven't created anything in PHP for years. However, I used to create stuff with Yii and I was pretty happy with it. My feeling was that if you use a proper framework and you're a decent programmer, PHP is actually not that bad. Why do you advise against it?
- _RPM 10y agoI wouldn't use laravel because it seems that the guy who made it hasn't yet earned my respect as the dictator of the project. It seems backwards compatibility is a real issue for his framework. He's no torvalds. I can't trust him to not break things.
- kluck 10y agoWhat functionality got broken?
- grimmdude 10y agoDefinitely Laravel. My company switched over at the end of last year and it's been great. I think it meets all your requirements except for `no php code in templates`, though I think you'll always have to have some minimum template code for looping/displaying data in any framework.
- jordanlev 10y agofyi Laravel does not use PHP code in templates. It has its own templating language called "Blade" (which I personally don't like, so I swap out Twig instead).
- tychuz 10y agoSo you're looking for a CMS - Wordpress and friends - clone, and not a framework?
- throwaway2016a 10y agoA lot of people here are saying Laravel. I agree. I haven't done a new site in PHP in a long time but I did jump back and try Laravel for a bit and was impressed.
- the_common_man 10y agoSymfony 3 has worked out very well for us. I don't have experience with lavarel or zend.
- Sir_Cmpwn 10y agoIf you have a chance to rewrite everything it's time to high tail it out of the PHP ecosystem my friend.
- kluck 10y agoMost people in my company have mostly been working with PHP and thus it would be too much of a break with the past to switch languages.
- jt2190 10y agoUse the framework that the team likes and wants to learn. You're going to get the best value from a framework that is matched well to the team's current skills and ambitions. Consider: * Team currently writes procedural code versus Framework requires understanding of Functional Programming or Object Oriented Programming * Team writes quickly and loosely versus Framework requires developers to code methodically and carefully (perhaps because it has less "out of the box" features and more "flexibility". Security is a good example here. * Team likes technical challenges versus Framework makes coding routine boilerplate and boring. etc.
- SadWebDeveloper 10y ago> What framework will you choose if you could start over? Anything that is not Python or Ruby or NodeJS based, i had so many problems and nigthmares with Django/Flask/RoR/bottle.py/web2py/Meteor/etc. > He say PHP Framework... Anything but CakePHP, Zend or Code Igniter maybe Laravel or Slim.
- whamlastxmas 10y agoThere is a lot of Node.js frameworks out there. Meteor is not really representative of them. Did you have issues with other Node.js frameworks too?
- zhte415 10y agoBasically 2 stages: Migrate existing code to something you're stable with. Then go on improve it, standardise, basic migration path. PHP, or .NET or Java, doesn't matter a lot. Get the job done.
- truentlolqt 10y agoive used Yii and it was ight. Php sucks dick tho