Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,749 members, 7,817,068 topics. Date: Saturday, 04 May 2024 at 02:50 AM

Zend Framework Tutorial - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Zend Framework Tutorial (2941 Views)

GENESIS FRAMEWORK+THEMES, WORDPRESS/WEB DEVELOPMENT VIDEO TRAINING & SOFTWARES / Ever Used Zend? / Php/mysql(cms) Developer Working With Zend Framework Wanted (2) (3) (4)

(1) (2) (Reply) (Go Down)

Zend Framework Tutorial by deco2come: 7:19am On Jan 21, 2011
I have heard a lot of Zend Framework and how it makes work so easy when writing php using it. I wanted to learn zend framework before but the first time I looked at it, it gave me the feeling that I need to learn the structure of zend framework which I found a little bit hard and waste of time. I looked for online tutorial that will explain things in details but found none.

Is there anyone here who knows how to use it. I'm willing to learn. Thank you
Re: Zend Framework Tutorial by Nobody: 4:54pm On Jan 22, 2011
Zend framework is very good if large web application and reusable codes are ur thing infact with zend things can get real easy and tough depending on what u are doing before I tell u how it works let me break it down I sue zend.it is still php and nothing special zend is more of a certain design pattern and way of building web app.first it is 100% OOP,it is revolved around mvc(model view controller).u will ask what's the advantage of zend with zend it has components for anything u need and best part is it comes with a online documentation wiv vast examples and a downloadble offline reference.let me talk about the best components one is the Zend_Db it allows u to query db with ease it is all abstracted that even a non database coder can make the best and secured query another component is Zend_Db_Table_Abstract which is a class that maps a table once u declare a variable as the name and primary key u don't need the query words u can use method like createRow and use the this->tablename=value and after all is done just call save and that's all,
Re: Zend Framework Tutorial by Nobody: 5:22pm On Jan 22, 2011
With that being said zend uses a specific folder structure.first of all a model refers a class that deals with data.ur data could be from db or xml or json,e.g a web site with name of people will a model class called people that will retrieve all form of data maybe like getpeoplename or getpeopleage anything that deals with people will be in that class the reason is an organized and seperation of data will make a project debuggable and sane.a controller is simply a function call it tells what function to call,ur controller recieves input from http urls e.g index.php/ is the main file automactically a default project will be created for u by using a command prompt program called Zend_tool u first change directory to the folder on ur server using cd I'm command project then create a project by zf create project WebContact. And viola ur zend project is created wiv all folders and htaccess.the htaccess redirects all links to index.php so index.php/about will call a class in the controller folder aboutController so index.php/contact will call contactController and each controller will look for a file in the view folder e.g contact.phtml will be display if index.php/contact is called. That's the basic stuff about zend now in controller class it extends a class that manages response and request objects via a variable called view.a view variables is manipulated in the controller and accessed in the view file.e.g if contactController has a function called viewEmailaddress in the function scope u can e.g $this-view->emails="remi@mail.com" and in view folder viewEmail.phtml and to read it just call print $this->emails.its easier to to seperate logic,template,data
Re: Zend Framework Tutorial by Nobody: 5:55pm On Jan 22, 2011
It is rather nice. I used it once sha, but i found it ehm somewhat complicated. But i think it is because i did not take time out to study those folder structures properly sha.

Then, i think i remember setting up some ms-dos commandline stuffs i used to create the structures. . . it is all blurry memory now. . .
Re: Zend Framework Tutorial by Nobody: 7:01am On Nov 02, 2011
Sorry for reviving this trend but am bringing Zend back my blog is down cuz it didnt serve my purpose pending my personal site i intend to use NL. if anyone got a problem bite me.

Zend Introduction
http://www.dreamincode.net/forums/topic/54296-introduction-to-zend-framework/
Re: Zend Framework Tutorial by Nobody: 7:17am On Nov 02, 2011
Before Setting Up for Zend Development
1. Before Setting up Zend Framework u will need an Apache Server running PHP 5.3 to be on the safe side though 5.2.8 will work its advisable to get Zend Server as it comes with Zend Library and the Zend Tool a batch script that sets ur project for you.

2. After installation of Zend Server, go to Command Prompt and type "zf.bat" if nothing happens or it shows unknown command, you will have to go into the Zend/Xampp Folder and look for zf.bat u can use the search but Xampp keeps its in the php folder and Zend Server keeps its own zf.bat in the ZendServer/share/bin/ folder so all we need to do is too add this to the ENV_PATH in Control Panel ->System/ Environment Variable add this to Path.close and start the command prompt and type zf.bat

3. it will display some command lines for Zend to creste a project enter ur Apache Server Directory where ur sites get hosted by using the cd command then type zf.bat create project NameOfProject and it create a skeletal Zend Framework Project and u are good to go from here. next time we'll look at directory structure. got to sweep the house grin.
Re: Zend Framework Tutorial by binkabir(m): 7:39am On Nov 02, 2011
@ poster, for single developer FW, i recommend cakePHP,proPHP, Yii or symfony
mostly zend is best for "dedicated servers" when u get it running on shared hosting, i bet u, you will regret it. (its dam very slow)
zend is a fw for group of developers. but if that is your take. please take you time to learn it.
Re: Zend Framework Tutorial by Nobody: 7:51am On Nov 02, 2011
i,ve used Zend FW for a project and its not as slow as people proclaim it to be after all there's the Zend Engine and the Zend Optimizer so i don't believe that also am a PHP 5 developer so i'm always looking forward to magic methods, and new features that make my life well, as for CakePHP i've heard good things about it to be frank CakePHP is not for me though i've heard its good for Baking awesome PHP Apps but ave gone far into Zend to go back most people site are slow because they include components not neccesary,dont use Apache Modules, and worst of all no caching. but thanks binkabir am already on the dark side. grin just kidding but Yii is another one i might look at but still i feel more familair with Zend framework cuz its the only one integrated with Dojo framework and best of all , coding Dojo in PHP saves me client ish. i wish u gave Zend a try on a good host.
Re: Zend Framework Tutorial by dhtml1(m): 7:56am On Nov 02, 2011
Please, stop the distractions and lets continue with the zend tutorials jor.
Re: Zend Framework Tutorial by Nobody: 7:58am On Nov 02, 2011
@binkabir but the require statements are what might make it slow, ZF 2.0 is almost out and it uses namespaces and is revised to be far lighter and only use what's needed. take care
Re: Zend Framework Tutorial by tushutt(m): 1:19pm On Nov 02, 2011
pc guru:

Before Setting Up for Zend Development
1. Before Setting up Zend Framework u will need an Apache Server running PHP 5.3 to be on the safe side though 5.2.8 will work its advisable to get Zend Server as it comes with Zend Library and the Zend Tool a batch script that sets your project for you.

2. After installation of Zend Server, go to Command Prompt and type "zf.bat" if nothing happens or it shows unknown command, you will have to go into the Zend/Xampp Folder and look for zf.bat u can use the search but Xampp keeps its in the php folder and Zend Server keeps its own zf.bat in the ZendServer/share/bin/ folder so all we need to do is too add this to the ENV_PATH in Control Panel ->System/ Environment Variable add this to Path.close and start the command prompt and type zf.bat

3. it will display some command lines for Zend to creste a project enter your Apache Server Directory where your sites get hosted by using the cd command then type zf.bat create project NameOfProject and it create a skeletal Zend Framework Project and u are good to go from here. next time we'll look at directory structure. got to sweep the house grin.

please can you help me with a detailed expalnation of how to succesful install zend i followed some online instructions and i ended up ruining my apache configuration. i had to reinstall it and since then didnt even bother to try it out again

i was able to get the zf.bat to work in the cmd but i couldnt access the default hmpage for the zf_tutorial
awaiting your reply
Re: Zend Framework Tutorial by Nobody: 2:18pm On Nov 02, 2011
1. First make sure Apache is installed
2.PHP 5.3 with Zend Debugger is installed neccessary for PDT(PHP Developer Tools) IDE but not complusory
3. Next make sure zf.bat works
4. Open command prompt
5. Use cd , To go back till u enter c:\
6. Cd Zend/apache/htdocs press enter
7. Then type zf.bat create project HelloZend

After this enter http://localhost/HelloZend, it will show the contents the app starts in public folder so u have 2 choices
1.Alter apache VirualHost DocumentRoot to point to HelloZend/public and make sure AllowOverrides for htaccess is enabled this will be serve only ur zend app,but u can't access other projects.

2.Operate it just by entering HelloZend/public/index but this is not ideal but works if u need to work on other projects(Non Zend). Hit me back and
I hope u're using zf 1.9 or higher. Take care
Re: Zend Framework Tutorial by tushutt(m): 2:28pm On Nov 02, 2011
thanks a lot i actually did as you said but after creating virtualhosts for zf_tutorial in my hosts file and pointing it to localhost all the other projects in my wamp localhost was pointing to the zf_tutorial index page

please expantiate more on the 2nd choice
Re: Zend Framework Tutorial by Nobody: 3:29pm On Nov 02, 2011
The option is just simply running it via http://localhost/HelloZend/public_html/ but it might not work perfectly. Give it a try
Re: Zend Framework Tutorial by tushutt(m): 3:35pm On Nov 02, 2011
ok thanks a lot man i'll do that
Re: Zend Framework Tutorial by Nobody: 3:38pm On Nov 02, 2011
No p will update tonight when NEPA brings light (Fucking govt).
Re: Zend Framework Tutorial by Nobody: 4:29pm On Nov 02, 2011
U might want to add some screencasts to this - for the sake of viewers. Dere are many interfaces we are talking about here.
Re: Zend Framework Tutorial by Nobody: 6:52pm On Nov 02, 2011
there's a perfect blog that does zend screencast he's good. let me look up the link.
Re: Zend Framework Tutorial by Nobody: 6:53pm On Nov 02, 2011
Re: Zend Framework Tutorial by Nobody: 2:13pm On Nov 03, 2011
Before Jumping into Zend Framework or Yii or YModulus Framework ,you must keep in mind that PHP 5 is full object oriented and these frameworks have embraced OOP and Design Patterns these constitutes as a stumbling block because 90% of PHP developers came to the scene of PHP 4 however PHP 5 is a total reconstruction from PHP 4.

What are the Techniques we need to know ?

1. Magic Methods : Magic Methods are special php function that are invoked by PHP Engine, u cannot declare functions as these as they already exist however php 5.3 is an exception because it embraces Namespaces. so what are the magic methods infact u have used some with knowing. e.g "__construct(),__call(),__get(),__set(),__clone()",

The Popular one "__toString()" is invoked when you attempt to print an Object it triggers the __toString() method which must be declared in your class. imagine it as a callback that triggers the function when the magic methods are being used.

Another good magic and powerful magic method is the __autoload method u wondered how all those frameworks never use require in the class and they seem to work well the __autoload can be declared in a file rather than a class.


function __autoload($className){
require 'Modules'.DS.$className.DS.'.php';
}
$dhtmlLovesPorn=new DHTML();


when a new object is created the autoload function is invoked there are several others such as get and set you should refer to your PHP Manual and acquainted with these as they ease and help you create a proper PHP5 application.
Re: Zend Framework Tutorial by Nobody: 2:23pm On Nov 03, 2011
2. Design Patterns ? what are design patterns think of them as ready made pattern to tackle specific solutions. design patterns are good though they should only be used when a complex logic presents itself there are tons of design patterns you can get into, for instance the Singelton Pattern allows you to restrict the instantiation of a class to a single object they are good for when resources are limited, imagine we had a class that could create multiple database Objects each calling the database or making CURL operations,we'd have too many uneccessary objects Zend/Joomla use the Singleton Pattern to retrieve a single instance, or do u need a mechanism of reacting to a data being changed in the system the Obeserver Pattern exists. the patterns exists in the PHP manual file but u can reference the killerphp.com for easy explaination. but one shud note that the usage of patterns shud only be used when neccessary some developers code in certain ways that equates "Killing a fly with an Hammer", i hope u get the picture
Re: Zend Framework Tutorial by Nobody: 2:29pm On Nov 03, 2011
Re: Zend Framework Tutorial by Nobody: 2:39pm On Nov 03, 2011
3. Exception Handling

Exceptions are error that are thrown when certain errors that we expect occur, when creating an application called PingMe we assume that for u to Pin People u should be logged in however what happen when the person send a value to the Database with empty values, Exceptions when the error occurs using die makes it hard to tell where the error occurred and from which function however Exception give u a printStackTrace() that traces all previous function calls to the function that threw the Exception it makes debugging easier and saner, i have debugged a Procedural PHP app and i swear i almost tracked down the former php developer to either kill him or stalk his family forever. angry. (not kidding am serious almost did). well it exceptions u can throw errors to the user without exposing detailed informations. however custom Exceptions are encouraged to enable better tracking of what type of Exceptions were throw, a SqlException can easily let you know that it was a SQL Related task as the General Exception makes it harder to narrow down the main cause.
to even go a higher notch u can u keep ur code in a try and catch block, and make sure that friendly messages are thrown then in the catch block it either logs the error to the Apache or sends u a mail to keep u informed of any error. now isn't that just smart programming.
Re: Zend Framework Tutorial by Nobody: 2:53pm On Nov 03, 2011
4. Never Underestimate UML and OAD

i once tried creating a wedding CMS in PHP using procedural coding that time i was brave enough,though lost my project to a crash but i faced hell, when coding in 100% Non OOP its hard to structure the app in Modules because the procedural deals with flow by than objects. i spent two months tracking functions and understanding what i was trying to do, i had no clear picture of what i wanted to build i spent another additional 2 months trying to understand where which calls were from, by then the company tagged it a runaway project, years later training the OOP and Aptech brain washing me with OAD and UML, it became logical to treat each unit as a Module, Modularizing you code makes it easier and close to real life entity, so where does UML come in it gives other a clear definition of what u intend to build and how it interact with other objects however in reality doing a full UML takes time especially if its a small scale project then OAD can be used on only complicated aspects. Frameworks like Zend,Yii,Joomla,CakePHP adopts the method of modularizing codes to separate units WordPress doesn't follow this pattern but as we know WP is a blogging tool so we can make an exemption.

There are tons of UML tools but the best i have come across is the AgroUML, though the name is quite funny "Agro" wink
Re: Zend Framework Tutorial by Nobody: 3:09pm On Nov 03, 2011
thats all for now i'd love to touch Namespace and Lambda functions but those are PHP 5.3 functions which are not compulsory to adhere to but neccessary. soon i will explain the folder structure of Zend a simple brief of it. take care but real life to take care of. PHP 5.4 is almost out
Re: Zend Framework Tutorial by Nobody: 7:13am On Nov 07, 2011
A Simple and well Explained tuts from Nettuts
http://net.tutsplus.com/tutorials/php/zend-framework-from-scratch/
Re: Zend Framework Tutorial by Nobody: 7:17am On Nov 07, 2011
A simple view of what goes on in Zend
Re: Zend Framework Tutorial by Nobody: 8:19am On Dec 20, 2011
Just waned to bring this up, by this evening i'll put some tuts on Zend and project setup and the rest
Re: Zend Framework Tutorial by Nobody: 10:42pm On Dec 20, 2011
http://okeowoaderemi.com/pdf/Zend Framework in Action.pdf

I left a Zend Framework tutorial quick guide its fast and good will remove it next week. enjoy
Re: Zend Framework Tutorial by Nobody: 9:13pm On Jan 20, 2012
Setting up a Zend Framework Project from Scratch- Part 1
http://okeowoaderemi.com/?p=43
Re: Zend Framework Tutorial by Nobody: 9:28pm On Jan 20, 2012
*Inspecting*
Re: Zend Framework Tutorial by Nobody: 9:39pm On Jan 20, 2012
@dhtml thanks bro, am seriously liking your classroom project its nice there's one Khan"s Academy wanted to a similar stuff like that for Blackberry, but mehn got exams as i didn't read for my previous exams. so gotta make up for it, lemme know if i can post tutorials on your classroom. peace bro. cry pls don't hack my site also lol.

(1) (2) (Reply)

Whatsapp Group For E-commerce / I'll Give You One Blog/news Wordpress Theme/template Free / How To Hack DSTV, Gotv, Digital Tvs And Other Digital Decoders Subscription FREE

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 70
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.