Zend Framework 2 - Your First Getting Started Guide


Introduction

For those who are new to Zend Framework, let me introduce - Zend Framework (ZF) is an open source, object-oriented web application framework implemented in PHP from Zend Technologies Ltd.


What you need to implement this tutorial

This is a small tutorial on installation and usage of Zend Framework 2 on XAMPP.

I felt the need to write this tutorial as it was a bit difficult for me to understand how things worked around in Zend Framework 2. I was having prior experience with Zend Framework version 1.11 but this tutorial does not require any prior experience with Zend Framework.

For this tutorial, I referred to Getting Started with Zend Framework 2 from the Official Documentation. Before starting please ensure that you are running PHP version 5.3.3 or higher. The only point on which this tutorial differs from the Official Getting Started with Zend Framework 2 is that here we are not using composer.phar and also does not discuss here how to setup virtual host.

For this tutorial to work I downloaded Zend Framework version 2.0.6. You may also download the same from here also.

Also you may download the complete source code from this zip archive: lazeez.zip.


MySQL Database

Now create a database say lazeez and execute the following MySQL code to create a album table under it.

CREATE TABLE album (
  id int(11) NOT NULL auto_increment,
  artist varchar(100) NOT NULL,
  title varchar(100) NOT NULL,
  PRIMARY KEY (id)
);
INSERT INTO album (artist, title)
    VALUES  ('The  Military  Wives',  'In  My  Dreams');
INSERT INTO album (artist, title)
    VALUES  ('Adele',  '21');
INSERT INTO album (artist, title)
    VALUES  ('Bruce  Springsteen',  'Wrecking Ball (Deluxe)');
INSERT INTO album (artist, title)
    VALUES  ('Lana  Del  Rey',  'Born  To  Die');
INSERT INTO album (artist, title)
    VALUES  ('Gotye',  'Making  Mirrors');

Steps to follow

After downloading and uncompressing lazeez.zip in your htdocs directory you have to perform the following steps:

  • Open global.php from lazeez-zf2\config\autoload and find the line 'dsn' => 'mysql:dbname=lazeez;host=127.0.0.1' Here change lazeez to your database name
  • Now open local.php from lazeez-zf2\config\autoload and replace your-mysql-username with your mysql username and your-mysql-password with your mysql password
  • After this extract the downloaded Zend Framework 2 zip file under under vendor\ZF2 directory such that there exists a folder named library in vendor\ZF2 and folder Zend under vendor\ZF2\library
  • Now you have to hit localhost/lazeez/public in your browser and if everything worked correctly then you will see text as shown in this screenshot below:
Screenshot of First Page after installation of Zend Framework 2(ZF2)

 

  • Now you have to browse localhost/lazeez/public/album and can find something similar to the below screenshot:

Screenshot of Albums Project Home Page


Conclusion

Zend Framework will help you write more maintainable and easily debuggable code through MVC architecture and Unit Testing.








Recommended for You »

  1. Biwi Mujhe Samajh Nahi Aata Paisae Kahan Rakhun Jahan Chupati Hun ..
  2. आँखों के इशारे समझ नहीं पाते होंठों से दिल की बात ..
  3. Should The Enemy Dare To Invade Our Country Annihilate Them To ..
  4. Beyond The Bounds Of Thought And Dream Circling The Vastly Void ..
  5. Work Expands So As To Fill The Time Available For ..
  6. The Law Of The River Like The Law Of Being Is Infinite ..
  7. Due To Its Inherent Nature Mind Can Either Be Linked To This ..
  8. Azeez The Aap Humaare Liye Aur Azeez Hi Rahenge Duaon Mein ..
  9. When You’re Trying’ Somethin’ New The Fewer People That Know About ..
  10. Redefined Definitions Atom Bomb An Invention To End All Inventions Cigarette ..

Share & Let Everyone Read









Draw shape below and click submit button to send us your message:

About Us


Our logo expands to iOLdot - Ik Oankaar Lazeez Dimension of Texting which tries to reflect our ideology.

The purpose of this website is to develop a Dimension to Texting through the Aesthetics of Words by providing Unique, Decent, Pleasant, Pure, Gentle, Clean, Refined, Inoffensive Thought Provoking Wisdom Quotes, Funny Jokes, Shayari, Motivational SMS, Greetings, Wishes, Proverbs, Dohe, Love Messages & much more.. We also encourage you to be part of this journey & share your creative content with us. Play your flute here..



What's more


moderated-content-kids-safe

Moderated Content

Safe for people of all Age Groups including Children.
sms-api-always-win

API

Display SMS on your Website or Blog at Zero Cost.
rate-content

SMS Rating

Gives You Power to Rate Content.
« Stay In Touch »