ZF2 Modules You Can Use Today
One key new architectural feature of Zend Framework 2 is its new module infrastructure. The basic idea behind modules is to allow developers to both create and consume re-usable application functionality — anything from packaging common assets such as CSS and JavaScript to providing MVC application classes.
As an example, for my own site, I've created: a "Contact" module for rendering and processing contact forms; a "SkeletonCSS" module for dropping in Skeleton into my sites; a "CommonResource" module with a very, very basic data mapper implementation, and a "Blog" module that consumes it to deliver the very blog you're reading now.
But the real goal of the module infrastructure is for developers to share their modules, so that other developers don't need to develop that very same functionality for their own site. And to my delight, that's already happening!
So, here's a list of some of the ZF2 modules I've found in the wild.
-
SkeletonCss. I mentioned this one already, but it's a version of SkeletonCss, an adaptive response CSS/JS framework, packaged for easy consumption as a ZF2 module. The git URI is "git://mwop.net/SkeletonCss.git".
-
DoctrineModule. One of the most frequently asked questions I get is, "Will ZF2 use Doctrine?" My answer has been that we'll provide a bridge — but the cool thing is that the Doctrine project has already decided to do it. Spear-headed by an enthusiastic ZF2 contributor/collaborator, Kyle Spraggs, this module provides the base functionality for integrating Doctrine 2 into your ZF2 site (primarily access to the base/common functionality). Two other modules provide additional functionality:
- DoctrineORMModule provides the ability to interact with the Doctrine 2 ORM, and
- DoctrineMongoODMModule provides the ability to interact with and consume the Doctrine 2 Object Document Mapper for MongoDB.
-
EdpSuperluminal. This module can be used to cache all classes you use in your application to a single include file — giving you a performance boost.
-
ZfcUser. This module was begun by Evan Coury, the lead developer behind ZF2's module system; its purpose is to provide a drop-in solution for registering and authenticating users. The module itself provides functionality consuming
Zend\Db
; however, several other modules are also offered to provide other persistence layers, including:- ZfcUserDoctrineORM module, and
- ZfcUserDoctrineMongoODM;
more are planned. The "Zfc" namespace is used because Evan realized he and several others were working on similar solutions, and felt that collaboration would lead to a better solution than each would develop individually; this in turn led to the creation of a "Zend Framework Commons" organization on GitHub, with the goal of providing high-quality modules solving common application problems.
-
AsseticBundle. This is a module providing integration with the excellent Assetic asset management framework.
-
TwitterBootstrap. Many developers are gravitating to the Twitter Bootstrap project for CSS layouts. This module depends on the AsseticBundle already listed above, and provides both Twitter Bootstrap as well as integration with the current (ZF1) incarnation of
Zend\Form
.
I've seen a number of others as well, and know of more on their way (as an example, a ZfcAcl module to complement the ZfcUser module). Writing modules is incredibly easy, and a great way to both learn ZF2 and collaborate and share with other developers.
Where are your modules?