How a noob tryin to learn Zend Framework
Monthly Archives: February 2012
February 18, 2012Posted by on
So, when I was getting familiar with Zend Framework I’ve encountered with the concept of “Helpers”. Now I know that understand ZF without the knowledge of what these “Helpers” are is impossible.
Because I was noob (and still I am), I was surprised to see that we can speak about “Action_Helpers” and “View_Helpers”, too.
So first I wanted to understand whats the difference between these two basic types of Helpers. I found a very nice and short comparsion on stackowerflow about this. I copy-paste the main idea behind these Helpers:
“An ActionHelper is for reusable functionality needed in the actions of your Controllers, while a ViewHelper is for reusable functionality in your View Templates…”
Now I understood the theory or “motivation” behind the concepts of _Helpers. Of course the job just half way done. In order to understand fully what a Helper is doing one needs to know how create/use them exactly in action..
So I found the following VERY clear short tuts:
- Lysender’s short tutorial about Action_Helpers.
- akrabat’s also short and also great tutorial about View_Helpers.
Both are very nice tutorials. Highly recommended who wants to understand the basics of _Helpers.
February 16, 2012Posted by on
Just a memo (for myself, of course).
Always have to watch out for the correct naming of classes, and files.
I just spent 5 minutes trying to find the solution for the problem: ‘*_Exception… cant find in the registry…blah, blah’ warning. Of course the autoloader couldn’t find the class because instead of ‘register.php’ I named it ‘regiser.php’.
February 16, 2012Posted by on
When you start to understand the Zend_Application, and getting clear how to bootsrap “resources” (classes..etc that your app will use), then you will see that there are a lots of options, you can give to Zend_Application. (You can put these options in an .ini file, too. see previous post)
So I raised the question: “Where can I find the complete options list?” You can’t find them in the official documetation.. there is a page where you can find some of these options, but much more out there.
So in #zftalk on freenode they gave me this link to an application.ini file. This is a cheatsheet, so here you can find all the available configuration options via Zend_Application.
After some days I found out that there is a site for ZF (zend framework) developers called “devzone”. There, they just linked the same application.ini cheatsheet 🙂 (what I’d just found on #zftalk with hard work) So I thought I will put this devzone into my RSS reader, coz I see they can give useful links for me, too (despite im noob at ZF).
February 12, 2012Posted by on
A month ago I decided I will learn a PHP framework.
I chose Zend Framework.
So I went to the quickstart quide (as of December 2011), and started to learn. I have to mention here, that I think before someone wants to learn any PHP framework, you will need some basic undertanding of the OOP, so how to use classes or why we use classes, the static, self, parent keywords… and some more. You can find zillions of tutorials out there about the basic PHP related OOP concepts.
So, as I said I went to the quickstart guide of Zend Framework.
Well, I found this quickstart quide somewhat cumbersome, I learned how to set up the basic things like folder structure…etc, but when I arrived to the layout and model sections I started to confuse…
I didn’t even know what *is* a framework at all, and how it operates, and wasn’t too good at programming, too.
After all, I stopped. But after 3 weeks I started again to understand this beast 😀
When I returned I started to search on Google for good ZF (Zend Framework) tutorials. Firstly, I started to read phpeveryday.com’s short tutorials. I think these are very good for a noob like me for starting. But I think its very basic, so if someone wants to really understand how ZF work, well, then have to move on..
Rob Allen’s online tutorial was the second source . I learned a lot of things from this, like ZF command line tools. But it was a little bit hard for me first .Maybe it was too short and covered too much things. I wanted a little “deeper” introduction, not short writings on the subject.
After all I found Rob Allen’s (same as above) Zend Framework in action book. Well this helped me a lot to understed a little more deeply the inner workings of ZF, and I’m still reading this book. What I found very useful are the “design patters” you can find these in the Appendix section of the book. I think no one can understand a framework without the knowledge of these “design patters”. Design pattern examples are the “singleton pattern”,the “registry pattern” , “frontcontroller pattern”… The whole thing will be much more clearl after you understand these patterns, so they are very very very important. (In my opinion.)
On the other side there are some problems with this book. The biggest is that it was written in 2009, its old. Zend Framework has changed a lot since then. (The book using ZF version 1.6, but today its at version 1.11).
In this book for example the bootsrtap procedure is old. I’ts completely changed, as I found out, nowdays the developers using the Zend_Application class and .ini files to bootsrap the so called “resources”. The book writes down how to do the bootstrap process “manually”, so its not problem to read through coz you can understand better this process, on the other side Zend_Application do this bootstrap nearly “automatically”, and developers use this because its easier to maintain your program after.. So its easier to bootstrap with Zend_Application (from an .ini file), but harder to see the inner workings of the bootstrap process..
Let’s stop for a moment. If you noticed, yes, my english is not the best. I’m from Hungary btw. But I’m tryin my best. I hope my minimum level english is at least understandable… if someone reading this blog at all.
So, to continue. I had to understand what is this Zend_Application class, what is this doing, and how to do the bootstrapping with it. I found this excellent post from monzee how to migrate from the old bootstrapping code (from version 1.8) to the newer (v. 1.9) which is now using the Zend_Application class. So this article will tell you the transition from the old “made by manually” bootstrap process, to the “automatic” (from the .ini file) one, which is using as I said the Zend_Application class.
Of course I read a lots of blogs, and the ZF documentation too in paralell, not just the above sources, to understand the bootstrap process, but these blogs/tutorials were the main line, what I covered above. These are what I found the most useful.
Now I know how the bootsrapping process works, and I started to understand the whole thing, though I still have to learn a lot. But I am just at the beggining, the crucial part just starts now.
I’m writing this blog to myself to serve as a diary as I learn ZF. My other aim is to practice the english language, too 😉