Frameworks choice

Post on 11-Jul-2015

936 views 1 download

Transcript of Frameworks choice

PHP Frameworks choice

Pawel Graczyk

October 15th, 2012Chicago

What should we expect from framework?

● Based on PHP platform● MVC● Friendly for modern approach (agile and decoupled)● Contain all features necessary for advanced system● Well tested (unit tests)● Stability● Active community of users● Active development over next 3-5 years● Easy to learn

Possible choices

● Zend Framework 1 (http://framework.zend.com/)● Zend Framework 2 (http://framework.zend.com/)● Symfony 2 (http://symfony.com/)● Lithium (http://lithify.me/)● Yii (http://www.yiiframework.com/)

Zend Framework 1 - Matthew Weier O'Phinney (http://mwop.net/)

+ Based on PHP platform+ MVC- Friendly for modern approach (agile and decoupled)- Ready for third-party products- Use new features from PHP 5.3 (namespaces etc.)- Less magic+ Contain all features necessary for advanced system- Well tested (unit tests)+ Stability+/- Active community of users- Active development over next 3-5 years-/+ Easy to learn- Integrated with modern template system- Ready for reusable code (modules introduced too late)

Zend Framework 2 - Matthew Weier O'Phinney (http://mwop.net/)

+ Based on PHP platform+ MVC+ Friendly for modern approach (agile and decoupled)+/- Ready for third-party products+ Use new features from PHP 5.3 (namespaces etc.)+ Less magic+/- Contain all features necessary for advanced system+ Well tested (unit tests)+/- Stability+/- Active community of users+ Active development over next 3-5 years+ Easy to learn- Integrated with modern template system-+Reusable (modules as a first class citizens)

Symfony 2 - Fabien potencier (http://fabien.potencier.org/)

+ Based on PHP platform+ MVC+ Friendly for modern (agile) approach+ Ready for third-party products+ Use new features from PHP 5.3 (namespaces etc.)+ Less magic+ Contain all features necessary for advanced system+ Well tested (unit tests)+ Stability+ Active community of users+ Active development over next 3-5 years+ Easy to learn+ Integrated with modern template system+ Reusable (bundles as a first class citizens everything is a bundle)

ZF1 vs (ZF2 / S2)

"How agile do we want to be?"

For ZF1● We know ZF1 (but do we really know it?)● More developers on the market familiar with ZF1● Not too agile (strongly coupled)

For (ZF2 / S2)● Easy to learn● More developers on the market who WANTS TO work with

modern technologies (ZF2 / S2)● More agile (decoupled)

ZF2 vs S2 - Architecture

"Do we want to have a full stack or library?"

For ZF2 (library) - have a initial setup but more configuration is needed. Less experienced developers are tempted to "do it better" or "fix something in framework". It often leads to code very difficult to maintain by team of people.

For S2 (full stack) - Provides initial setup and supports python like philosophy of "One good way of doing something".Less experienced developers are less tempted to extend a framework.Framework is strongly decoupled, developer have a freedom of different setup.

ZF2 vs S2 - StabilityFor ZF2

Stable for over 1 month. Current version: 2.0.2

● Stable, but is it stable enough?

For S2

Stable for over 1 year. Current version: 2.1.2

● Rock solid stable

ZF2 vs S2 - Reusable codeBundle/Module - reusable code ready to use "out of the box". It may contain all parts of MVC.

Examples: zf-assetic-module or FOSUserBundle

For ZF2

● Over a 100 of modules (http://modules.zendframework.com/)● Most of modules still in development

For S2

● 1696 bundles - (http://knpbundles.com/)● Lots of third-party bundles have quality not worse than framework

and are used for default configuration.

ZF2 vs S2 - Learning curveConvention over configuration - things works in most expected way by default. The effort is needed to change the way things works but not to make them work.Magic - Lack of clarity in system behaviour. Unnecessary automatisation. Things happen and appear unexpectedly.

For ZF2

● less magic (???)● convention over configuration (???)

For S2● less magic● convention over configuration

Both are easier to learn than ZF1

ZF2 vs S2 - Usage of framework componentsZF2 is used by:

● ???S2 is used by

● Silex: BrowerKit, CssSelector, DomCrawler, EventDispatcher, HttpFoundation, HttpKernel, Routing, Form, Translation, Validator

● Goutte: BrowserKit, DomCrawler, CssSelector, Process, ClassLoader, Finder

● Behat: Console, DependencyInjection, EventDispatcher, Finder, Yaml, Config, Translation

● Assetic: Process● Doctrine2: Console, Yaml● Propel2: Console, ClassLoader, Yaml● PHPUnit: Yaml● FLOW3: Yaml● Midguard CMS: most of them in their next version?● phpBB 4: most of them?● Drupal 8*

What I like about Symfony 2 ●●●●●●●●●●●●●●●●●●

●●●

●●●●●●●●●●●●

●●●●●●●●

ZF1 vs ZF2 vs S2 - summary● ZF1 - Outdated. ● ZF2 - Many initial ideas and requirements was abandoned. The

result is framework quite similar to S2 but with less features and possibly worse stability (for today at least).

● S2 - Stable and more comprehensive. "Battery included" approach.