Extending the art & spirit of PHP, Zend Framework is based on simplicity, object-oriented best practices, corporate friendly licensing, and a rigorously tested agile codebase.
Classes that abstract and encapsulate business logic
-Nick
A domain model in problem solving and software engineering is a conceptual model of all the topics related to a specific problem. It describes the various entities, their attributes, roles, and relationships, plus the constraints that govern the problem domain.
ZF leaves this layer up to developer, but does provide several patterns to assist. Models are NOT simply reading / writing to DB, Models can be persisted in numerous ways.
Doctrine can be integrated with ZF2 using a module. Doctrine is an ORM / ODM based on the Data Mapper pattern. Entities are managed by an Entity Manager, which uses the Unit of Work pattern to persist entities transparently and efficiently
The "glue" of the MVC pattern.
"Things" that need initialized every request and made available to the rest of the application through a resource registry.
Resources can be initialized using resource methods in your bootstrap class or using resource plugin classes. The latter is preferred for re-usability.
Can be configured to lazy load multiple types of caches, e.g. APC and Memcache
Initializes a single Zend_Db adapter
Used to configure the Zend_Dojo view helpers
Probably the most common resource you will load as it is used to configure Zend_Controller_Front. This resource provides the ability to set arbitrary front controller parameters, specify plugins to initialize, and much more.
Used to configure Zend_Layout
Used to setup an application-wide locale which is then used in all components that work with localization or internationalization.
Configure a single Zend_Log with multiple writers
Instantiate a transport for Zend_Mail
Used to initialize your application modules.
Note: modules are one area that the Zend Framework developers acknowledge they didn't get quite right. Zend Framework 2 handles modules much better.
Initialize multiple Zend_Db adapters
Configure a Zend_Navigation instance
Used to configure the router that is registered with the Front Controller
Configure Zend_Session and optionally initialize a session SaveHandler
Initialize a Zend_Translate adapter
This resource provides the ability to configure and instantiate Zend_Http_UserAgent for use within your application.
Used to configure a Zend_View instance. It also creates a Zend_Controller_Action_Helper_ViewRenderer and registers the ViewRenderer with Zend_Controller_Action_HelperBroker
You may define an __autoload function which is automatically called in case you are trying to use a class/interface which hasn't been defined yet.
- PHP.net
Defers class loading until the last possible moment = performance boost. It is recommended to strip out require_once from everything but Zend/Loader/Autoloader.php
"Foo_Bar_Baz" corresponds to "Foo/Bar/Baz.php" on the filesystem
Uses include() which will trigger a PHP Warning every time it fails
Write better code!
May need to extend abstract class or implement an interface, but they are still just classes
Related classes share common prefix e.g. a library containing view helpers could contain a number of classes with prefix "Foo_View_Helper_"
Everything after common prefix is the "short name" e.g. "Foo_View_Helper_Bar", short name is "Bar"
Once stack of prefix paths is exhausted, Zend_Loader_PluginLoader_Exception is thrown
Override a view helper to change how a form element is rendered:
$view->addHelperPath('foo/view/helpers', 'Foo_View_Helper');
Note: Zend_Front_Controller has a plugin system, but it is different. Plugins have to be registered individually.
Nicholas Calugar
Senior Software Engineer
twitter.com/socalnick
https://github.com/socalnick
More detail: http://goo.gl/b1FF0