Getting Started With Zend


This morning, we finished getting the Zend server installed on our dev box, so we can take advantage of that option with our applications, and got the Zend Framework in place.  Getting the skeleton app going was easy, just download, unzip, upload, then run the three composer commands.  Only minor hiccup was our PHP CLI had to be fixed to point to the updated one.  Also, at least for our set up, on the .htaccess directive in the public folder, we had to add

RedirectBase /

after the RewriteEngine On line to make it work correctly.  Otherwise we got 500 errors.  We had to do the same with CakePHP so probably something with our server configurations being different from the "norm".  Anyway, with all that, we have the initial skeleton app going and yay, it works

One thing I noticed pretty quick is that they made a major shift in architecture between Zend v1 and v2.  With v1, the root of your app has application, library, public, and tests folders. Under application, there are folders for config, controllers, models, and views.  In v2, under your application root there are folders for config, data, module, public, and vendor.  Then under Module you make individual albums for each "module, with config, src, and view folders.  The src folder then has another folder, with the same name as the module, and then inside that folders for controller, form, and module. 

It seems more levels that should be needed, to me, but from the user guide it appears part of the reasons this was done was for the Namespaces stuff, one thing I didn't really deal with in any of my PHP tutorials.  After going trough the first few sections, mostly making the starting module for "Albums, I had a layout like this.

For now, will give it a try.  It's hard for me to really think of some apps in terms of "modules" but we'll see how it works. So first it has you make all those subfolders.  Weee!  Then to make our first class.  For this tutorial, it has you make an Album app. This one is definitely more config based versus automagical, even in v2, which is fine as it means greater flexibility.  Beyond that, other than why the file structure is so odd, it is fairly easy to understand.  Just more configuring in different places.

Having to use something called poedit and have it compile "mo" files for the tutorial is annoying.  We don't do translations for apps for the most part, so it would have been nice if the tutorial had made it clearer how to skip all that if you don't need it. So checked the layout.phtml file and remove removed the $this->translate() wrapper from bits of text and that worked fine.

After the first tutorial, there is a second one (building a "to-do" list app) that looks at also using the ZendStudio builder.  I think it's worth going through as well, even if you are like me and using something else (in my case, of course, Dreamweaver) because it also includes info on the actual breakdown of the skeleton application, Zend's dispatch cycle, getting diagnostic info, etc.  So it's another little app, but approaching the learning from another stand point.  Will be hitting that chapter more thoroughly tomorrow.