Zend Framework 2 – what changes?

Zend Framework is one of the best open-source PHP frameworks on the market. It's the basis for Magento and other open-source and commercial platforms on the market which cover a wide range of needs:

  • E-commerce
  • Content Management Systems
  • Multi-purpose portals
  • APIs and specific endpoints
  • High-data management

With all this baggage in 2010 Zend Framework has barely reach its second library version ZF2.

Zend Framework 2

ZF2 has the advantage of bringing some of the best development OOP/MVC concepts alive in PHP, but due to the difficulty in usage it was not implemented much compared with its ZF1 sibling until recently.

What are the changes in Zend Framework 2?

Zend Framework 2 is build specifically for usage with either a dynamic or static composer based AutoLoader. The difference is that compared with ZF1 there is no require based statements and has been migrated to namespaces (PHP >5.3).

The framework comes with a completely different standard library definition and an improve model managing sessions. Auth support is available for table based authentication, digest and basic http authentications, ldap and more through the extension of the abstract auth manager.

Although not recommended for beginners you have the ability of bypassing the composer and re-factor the autoloader so that it does not load everything but the required classes with the loss of dispatched events.

What is the big advantage of Zend Framework 2?

Why should we use ZF2 if setting it up is at least twice as hard as it was with Zend Framework 1? Well there are some major advantages:

  • Namespace based usage of loaded classes – this means that the possibility of conflicts between additional libraries is close to 0 as each library will make usage of it's own defined namespace;
  • Free to work data modeling. Although it might be a big "NO" for new developers, generally it's a must nowadays as it permits the definition of you own model files, made to your liking which will interact exactly as you want them with your prefered database storage engine. This means no issues in using stored procedures or custom queries for each of you own models as they will be fully build by you.
  • Security improvements and proper management of MVC concepts.
  • Factory based management to a higher degree.
  • Last, but not least, less code loaded for the same job, making Zend Framework 2 a faster engine than the first.

Any questions? Please feel free to comment bellow and I will do my best to help. Also a piece of advice: START with the skeleton app.

Leave a Reply

Your email address will not be published. Required fields are marked *