Introduction to Zend Framework 2

April 29, 2013 / By: Adrian

Zend Framework 2If you are new to the Zend Framework, it might be a bit overwhelming to get started. The good news is that Zend has now released a new version, Zend Framework 2, which means you will not have to worry about converting what you know.  Most of it will not apply anyways, as Zend is now taking a new approach with the framework’s setup.

The first thing you will notice that is different about ZF1 and ZF2 is how to install and set up an application. With ZF1, you would typically download the files to a directory on your server (MAMP or WAMP) and set your PHP include path (php.ini) to reference the ZF library. This will keep you from having to download the entire framework for each project. With ZF2, there is a huge emphasis on Composer.  If you are unfamiliar with Composer, it is a package/dependency manager for PHP that Zend uses to install the necessary libraries for your project. Once Composer has set up a new application from Zend’s skeleton application, the last step is configuring a vhost for your project. Once that is complete, you are now set up with a ZF2 project.

Modules are now a big part of ZF2.  From the ZF site, “Zend Framework 2 uses a module system and you organize your main application-specific code within each module”.  For each different section of your site, typically you would set up a different module to handle the different functionality. For instance, if a web application has both users and albums, you would create a module for users (e.g. users/my-account) and one for albums (e.g. albums/{username}/{album_name}).  This is what Zend is referring to as application specific code. There are a few key files that your module needs to have in order for it to be registered {module_name}.php and a module.config.php. These files tell Zend what to load and where to load it.

The last big difference in configuration and setup between ZF1 and ZF2 is the application configuration and routing.  In ZF1, it was very easy to set up an application.ini and routes.ini file and have Zend load these settings. In ZF2, it is very different and much more complicated. It has now been split up into a module with different directories for each section (modules, DB, memcache, etc.). In order for Zend to load your modules, you will need to register your module in the module auto_loading array.

For more detailed information, with working examples, you can visit the ZF website (http://framework.zend.com/learn/).



 
 

Need Help?

Give us a call

786 393-5826

Talk with one of our professionals and start working with TECKpert today.

Speak with us

Over 25 national and regional awards

2018

Daily Business Review - Best Of Web Design - Ranked #2

Daily Business Review - Best Of Internet Marketing - Ranked #2

Communicator Award - General Manufacturing - Marmol

Communicator Award - General Lifestyle - Marmol

2017

South Florida Business Journal - Top Web Design and Development Company - Ranked #2

Daily Business Review - Best Of Internet Marketing - Ranked #3

Daily Business Review - Best Of Web Design - Ranked #3

Davey Awards - Silver Award - Zilbert

2016

South Florida Business Journal - Top Web Design and Development Company - Ranked #2

Daily Business Review - Best Of Internet Marketing - Ranked #2

Daily Business Review - Best Of Web Design - Ranked #3

Davey Awards - Silver Award - CorkageFee (website)

2015

Daily Business Review - Best Of Internet Marketing - Ranked #3

Daily Business Review - Best Of Web Design - Ranked #3

South Florida Business Journal - Top Web Design and Development Company - Ranked #5

2014

W3 Awards - Silver Award - CorkageFee (Mobile Application)

Communicator Awards - Award of Distinction - ERP Maestro

Communicator Awards - Award of Distinction - AADS

Communicator Awards - Award of Excellence - TECKpert

Davey Awards - Silver Award - CorkageFee (Mobile Application)

W3 Awards - Silver Award - Hubdin

2013

Davey Awards - Silver Award - Midtown Women's Center

Davey Awards - Silver Award - MSG Law

W3 Awards - Silver Award - Leon Cosgrove

Communicator Awards - Award of Distinction - 400SunnyIsles.com

Communicator Awards - Award of Distinction - Esolist.com

Communicator Awards - Award of Distinction - CSK Mobile

2012

Interactive Media Awards - Winner for TECKpert.com

Daily Business Review - Best Of Internet Marketing and Web Design