Saturday, February 28, 2015

Installing Zend Framework

Before we move on with the installation let it be know we are referring to Zend Framework 2 (Zf2) whenever we say Zend Framework.

The first major release of Zend Framework was Zend Framework 1 and as at the time of this tutorials the next version of Zend Framework, which is Zend Framework 3 was already near completion.

 To make the installation of Zf2 easy the Zf team created the “ZendSkeletonApplication”, which is basically a template to start developing any website from, it hosted on git.

So this would be our first time to use the git that we earlier installed to run on command line. If you have not done that see this tutorial.

Start windows command line and change your directory to where your file would be store in xampp like this:-

            cd c:/
            cd xampp/htdocs

Once you are in this directory in command line run the git command below:-

            git clone git://github.com/zendframework/ZendSkeletonApplication.git

If your installation of git for command line was successful this should start downloading the ZendSkeletonApplication. You must have noticed the word clone in the above git command, it is a git jargon for download.

Once the download progress hit the 100% mark open the folder and rename the folder with the name “ZendSkeletonApplication” to “zfnigeria” being the website we want to create. Remember the folder is in your xampp htdocs folder and you can find it in the following directory. C:\\xampp\htdocs.

Assuming you have closed your window’s command line start it again and change the directory to the htdocs folder as described above and this time don’t close it. Then further move it into the zfnigeria folder like this:-

            cd zfnigeria.
Now if you go to your browser and try to access the site like this http://localhost/zfnigeria/public it would result to error because as at this point not all the files required by zf2 have been downloaded. We would need to use composer to download whatever other files that are remaining.  

Composer is another PHP tool which is used for the management of dependencies. It is simple to understand, a configuration file in your application that you can add all the code for the dependency files. In the case of Zf2 you can find this configuration file named composer.json in the zfnigeria root directory. We would come back to this file but let us continue with the installation.

Maximize your command window, remember I said don’t close it the other time. Now from where we stop in the windows command line before, run the following php commands one after the other.

            php composer.phar self-update
            php composer.phar install

At the progress mark of 100% all the dependencies files would have been successfully installed to enable us first access our website. From your browser load this address again http://localhost/zfnigeria/public. You should see the screen below if you have follow the steps illustrated in this tutorial.

We have successfully installed Zf2, next we would look at:-

·        Configuring the document root of our server to enable us view our website at http://localhost.

·        A brief description of the structure of Zf2

·        Creating the look and feel of our website from the template we have.

No comments:

Post a Comment