Zend Framework 2 - Your First Getting Started Guide
by Lazeez SMS CollectionIntroduction
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:
- Now you have to browse localhost/lazeez/public/album and can find something similar to the below screenshot:
Conclusion
Zend Framework will help you write more maintainable and easily debuggable code through MVC architecture and Unit Testing.
♥ Recommended for You »
- Life Laughs At You When You Are Unhappy Life Smiles At ..
- Don T Marry For Money; You Can Borrow It Cheaper ..
- Mil Kar Bichadna Dastoor Hai Zindagi Ka Ek Yahi Kissa Mash Hoor ..
- ਬਿਬਾਯਦ ਕਿ ਯਜ਼ਦਾਂ ਸ਼ਨਾਸੀ ਕੁਨੀ ॥ ਨ ਗ਼ੁਫ਼ਤਹ ਕਸਾਂ ਕਸ ਖ਼ਰਾਸ਼ੀ ..
- Courage Is The Most Important Of All The Virtues Because ..
- Indian Airline S Slogan A Warm Experience And Motherly Treatment Warm Because The ..
- Be Careful Who You Open Up To Only A Few People ..
- Toughest Moments Of Life Are Not Those When Tears Come Out ..
- यह बारिश यह बिजली आपके ..
- Rango Ki Varsha Gulaal Ki Fuhaar Suraj Ki Kirne Khusiyon Ki ..
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..