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.
59 comments
[ 3.1 ms ] story [ 125 ms ] threadIt'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/
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.
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.
https://www.gnu.org/licenses/license-list.html#ModifiedBSD
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).
This rules out Symfony and Laravel which are imho the only sane options in php.
Why do you need this requirement ?
I think Laravel has the same development model.
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).
octobercms.com is based on Laravel
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
CodeIgniter is only good for very simple website. It miss a lot of functions that a sophisticated framework has (eg Laravel)
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_lar...
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...
Wordpress is quite fine for most things though.
> - 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
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.
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?
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.
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.