5
votes

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 use 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.

2
Good question ;) The use-at-will architecture make the "best practice" hidde in the pile of custom setups and extending. - Tomáš Fejfar
The problem is that there's not 1 way to do things, even if you follow "best practices". So read some books covering the subject, study some projects, read some blogs and go from there. There's a LOT of information out there, so it might help to focus on one thing at a time. - wimvds
I was aware of the other question, but it was a bit old and I was hoping for newer examples since many of the links were broken. @wimvds: I know there is not just one way, but I want to see some good examples. I've been reading docs and various tutorials as needed but I want to look at a real project in action to see what else I can learn. Thanks! - Matt
Hmm, seems like most projects use their own "library" on top of Zend Framework with their own extra plugins. That took me a while to figure out, but now I see that's how a lot of projects handle common things like authentication and ACL. This is definitely helpful - Matt

2 Answers

2
votes

I'd recommend the following resources:

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.
1
votes

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.