Zend Framework 3.0 installation and creation of initialization project tutorial, zendframework

Source: Internet
Author: User

Zend Framework 3.0 installation and creation of initialization project tutorial, zendframework


Recently, I started to learn about PHP frameworks. However, there are seven or eight PHP frameworks.

Baidu, some people say ThinkPHP is simple and violent, some people say Laravel is too tall, and so on, it is difficult to choose.

In the end, I chose to start with Zend Framework officially designed by Zend. (The CSS Framework used inside Zend Framework is my favorite Bootstrap)

At least in 2016, Zend Framework has been upgraded to 3. version x, according to the official introduction, 3. the execution speed of Version x is 2. the version x is 4 times better and supports PHP7.

For installation purposes, I always feel that the latest version is required ..

When Zend Framework is to be installed and configured, it is found that there are many explanations in English documents on the Internet. At the beginning, there is no way to start with the English official website ..

(In Baidu or video tutorials, most of the Zend Framework configurations previously correspond to 1. x or 2. in Version x, I didn't start using Composer at that time, so it took me a long time ...)

Installation environment Introduction:

OS: Windows 10 (if it is a high-end MAC or LINUX, it may be similar, but SORRY is powerless ...)

Apache: 2.4.25

PHP: 7.1.6 (if PHP5.x is still used in 2017, is it a bit low? Hey hey)

(The installation and configuration are directly completed through XAMPP3.2.2 integration. For details, refer to Baidu ..)

IDE: PhpStorm (JetBrains)

To create a project, follow these steps:

(1) Installation of Composer

First, go to the Zend Framework official website framework.zend.com.

Click "Get Started" on the right of green Superman on the homepage or "Install" on the top to go to the installation overview page.

It is officially recommended (by default) to use software called Composer for various installation and configuration details. The Composer software is very powerful. If you want to install other frameworks such as ThinkPHP and Laravel this year, you will find that the official websites of those frameworks also allow you to use Composer for installation and configuration.

Some people may say that there are not various versions of Archives on the right that can be downloaded and used directly?

Yes. All packages of 1.x and 2.x versions are not of version 3.x .. About 3.0 has been officially forced to use Composer for installation (as if it could be done on GitHub)

So we need to install Composer first, to getcomposer.org/download/, for Windows users, download the Composer-Setup.exe to open it.

Install php.exe in the middle of the installation. If you use XAMPP, WAMP, or LAMP like me, it is usually in the php folder of the software.

After the installation, enter composer in the command prompt. A large coposer text and a bunch of parameter introductions will pop out, indicating that the COMPOSER is successfully installed.


(2) Use Composer to create a Zend Framework project

In the previous framework.zend.com/downloads page, we can see that the official Command provided to us is> composer require zendframewok/zendframework.

However, we do not have to do this...

In this way, the 61 packages of Zend Framework will be installed in your computer (enterprise development does not need all the packages ..)

Therefore, I chose the MVC Skeleton Application of Zend Framework (an option with the same name can be seen on the right of the webpage ).

This is a version that contains the core content of the MVC core program (equivalent to the so-called "Standard installation", and the previous version is "complete installation ..)

I created a folder named ZendFramework under D:/, and then input> composer create-project zendframework/skeleton-application D:/ZendFramework in the command prompt.

Wait a moment and you will find a bunch of items in the ZendFramework folder. The project is successfully created ~~ This is all about the framework ~~

The folder in the framework is roughly unchanged, but the Application folder originally containing the controller and view disappears from the first directory in version 3.0 and is placed in a folder called module.


(3) test Zend Framework

Move the Zend Framework folder to the root directory where you use localhost (XAMPP is the htdocs folder by default ).

Start Apache and open the browser. Enter localhost/ZendFramework/public (because the index. php file of Zend Framework is in the public folder)

If the Welcome page of Welcome to Zend Framework appears, it is OK ~~

From the "Congratulations! You have successfully installed the ZF Skeleton Application. You are currently running Zend Framework version 3.0.2. "We can also see that we have successfully installed Zend Framework of version 3.0.


Zend Framework 3 has built-in. htaccess file configuration for modifying the Overwrite function. In theory, the new version of Apache + PHP7 can be directly used without modifying the source code.

However, if it is an old version of Apache or PHP, you may need to modify httpd. conf and php. ini (please refer to Baidu for details ..)

If you want to install other frameworks, I think it should be similar? It's all about Composer ..


I hope this article will help those who encounter the same difficulties ~~


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.