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. Money Talks Mostly Lies ..
  2. To Know Another Is Not To Know That Person’s Face But ..
  3. Hariyali Jhoola Teej Hai Aayo Naach Reho Baagaan Ma Mor Baithe Ho ..
  4. You Are Walking On A Long Weak Bridge It S Really Scary ..
  5. दिल को जला कर दी है ज़माने को रौशनी जुगनू ..
  6. In Eternity There Is No Time Only An Instant Long Enough ..
  7. What Is MOM GOD Couldn T Be There With Every Child So He ..
  8. Naya Savera Nayi Kiran Ke Sath Naya Din Ek Pyari Si ..
  9. Patient Aapne Nurse Bahut Achchi Rakhi Hai Uske Haath Lagte Hi ..
  10. Dekh Liya Hai Chehra Tumhara Ab Aaftaab Kis Ko Chahiye Akhein ..

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 »