开发者

Example Zend Framework Project 1.8+

Let me begin by saying this; I know that similar questions exist, but they are a couple years old and ZF is changing quickly. I want a more recent example.

It has been noted a lot that the documentation on Zend Framework is lacking. I've read a lot of it and used it to start up a few applications, but I find that it is really difficult to understand how to do things properly. My biggest issue is where various components belong, where they should be instantiated, etc.

I am trying to follow MVC best practices, with thin controllers, fat models. I am also trying to use the latest MVC stack including Zend_Application and the recommended Bootstrap classes.

I want to see an example site that uses best practices for the framework which can demonstrate the following components (ideally):

  • Zend_ACL/Zend_Auth: how to actually use them in an application, how to fit it in to your model, etc.
  • Zend_Layout: how to do this properly with common parts such as a menu
  • Zend_Navigation: I mostly don't know the best practice for instantiating this.
  • Zend_Cache: Again, where does it belong, do you use it in Controllers (probably?)
  • Zend_Db: I want the example to use a database obviously, but I'd prefer just using ZF and not Doctrine
  • Zend_Feed: I'm not completely sure how to make an RSS feed properly (i.e. set the content type, etc.)
  • Zend_Form: I haven't used this yet, but I understand it is good for validating data passed into the Model. I'd like to see this in action
  • Zend_Paginator: Again, where do you instantiate this, Model or Controller?

I know I do not need to use everything in the framework, but I want to try to u开发者_高级运维se whatever may fit my needs and I'd like to learn more about it.

So do you know of a good example that uses the Zend MVC and some or all of these components? And one that follows a lot of best practices? Ideally, it is using at least 1.10, but anything 1.8 or later will suffice.


I'd recommend the following resources:

  • Zend Framework manual (seems obvious, but it's really great and sufficient in most cases),
  • Sample open source projects based on ZF, like Magento or the other discussed already,
  • Zend Framework tag on Github (e.g. PasteBin or ZFPlanet,
  • Source code from Books (e.g. StoreFront).

To answer the other questions:

  • Zend Cache has an action helper and application resource to make it really simple in usage,
  • Zend Feed in action may be seen in ZFPlanet,
  • Zend Paginator may be set up in bootstrap, using static methods.


You can check out cms systems build in ZF. One is TomatoCMS. The list of Projects & Applications using ZF is here. Zend Framework website is build in ZF too.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜