Zend Framework is very powerful, and many people do not use it at it’s full potential. This Zend Framework Cheat Sheet serves as a guide to supper often used build in methods, helpers and classes.
The Zend Framework Cheat Sheet is designed to live on the developer’s bookmarks bar, to make life a bit easier. A description of what is on the cheat sheet follows, or if you are impatient, you can go straight to the full size Zend Framework cheat sheet.
The request object
The request object is very heavily used in action controllers for various tasks. The cheat sheet includes the most common ones like getting params, determining the HTTP method or retrieving information about the current controller/action.
Action Helpers
Again action helpers are something that is constantly used. Some tend to ignore them and write beautiful code:
//at the end of some action die(json_encode($response));
The included action helpers are the ones that can be used with just copying and pasting. For more complex usage and full reference you can check out the official guide.
View Helpers From the controller
This section provides snippets for accessing the view helpers from the controller. These actions can be done from the view also, but in a lot of cases the controller is a bit more “aware” of what has to be added to the head of the page.
The response object
The response object is the logical counterpart to the request object. Typically is not used as much as the request object, but it would be a loss to not include some of it’s methods in the cheat sheet.
Recommended Project Directory Structure
Since Zend Framework is so liberal (and highly configurable) about where files are stored, developers can find themselves wondering where is the “right” place for a particular resource. The cheat sheet includes the project structure as proposed by the official guide
View Helpers
The problem with view helpers is that a lot of IDE’s can’t autocomplete them. Having a quick peak at the cheat sheet will quickly save you from having to digg it out from the official documentation. Some of the included helpers are the action helper, partial helper, placeholder helper, doctype helper, all the head-Stuff helpers and some more.
Getting stuff anywhere
Often one finds himself in a file far far away in a need of an object. What follows is a web search “zend, how can i get {insert class name here} anywhere”. The cheat sheet includes static calls for retrieving often used objects such as the request, response, view, database adapter, the bootstrap, configuration options, auth instance and a particular cache instance.
Download
So now that you know what it does, please feel free to bookmark/download/print out the Zend Framework cheat sheet:
Please note: If you wish to link to the Zend Framework cheat sheet from elsewhere, please link to this page so others find the description, rather than linking directly to the sheet.
For the section “Recommended Project Directory Structure” I would recommend using the so called “Using a Conventional Modular Directory Structure” – found here http://framework.zend.com/manual/1.12/en/zend.controller.modular.html