Home  >  Article  >  Backend Development  >  Learn the Yii2 framework from scratch (1) Install the Yii2 framework through Composer, yii2composer_PHP tutorial

Learn the Yii2 framework from scratch (1) Install the Yii2 framework through Composer, yii2composer_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:20:32783browse

Learn the YII2 framework from scratch (1) Install the Yii2 framework through Composer, yii2composer

I am learning PHP recently and am looking for a framework to learn that can be used quickly. When I first watched the Band of Brothers video, the instructor recommended ThinkPHP. So I chose ThinkPHP to try. This framework is not difficult to get started and can quickly develop an application. Suitable for small business applications. Because it was developed by Chinese people, Chinese support is better. There are relatively comprehensive documents, and the official website community is also relatively active. Because the projects I work with all use Oracle databases, I want to find a PHP framework that has better Oracle support, but the ThinkPHP framework's support for Oracle is really not good. So I changed to the Yii framework to try out its support for Oracle.

The current stable version of Yii framework is 1.1.14. Currently 2.0 is a beta version. I spent a few days learning Yii1 to create applications. There is not a lot of documentation about Yii. Most of them are original in English. But the support for Oracle is okay. AR technology is used. I recently read the documentation of Yii2. It incorporates PHP's namespace concept and many useful features such as Bootstrap and smarty. It was a great improvement over Yii1, and finally I decided to learn the Yii2 framework. Based on the understanding of Yii1, Yii2 should be even better.

Today I finally figured out how to install Yii2. It’s really hard work for a novice like me. Next, we will introduce how to install Composer and how to use Composer to install Yii2.

Composer is a tool used in PHP to manage dependency relationships. You can declare the external libraries (libraries) you depend on in your project, and Composer will install these dependent library files for you.

Windows installation of Composer:
1. Download Composer

Official website download: https://getcomposer.org/download/

2. Enable openssl support for PHP

Modify D:WAMPbinphpphp5.4.12 configuration file php.ini

Remove the comment;


3. Install Composer

The "next" installation is complete.

After the installation is complete, you will be prompted to reopen the CMD command line.

Install Yii2 - advanced template
1. Download yii2 - advanced template

Official website download: http://www.yiiframework.com/download/

After downloading, unzip to
D:WAMPwww

2. Install through composer

Open CMD and jump to the directory
D:WAMPwwwadvanced

Let’s generate an app named “yii2test”.

Enter command:

composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-advanced ../yii2test

Wait... ...the following interface appears, indicating that the installation is successful.

Learn the Yii2 framework from scratch (1) Install the Yii2 framework through Composer, yii2composer_PHP tutorial

3. Initialization project

Execute CMD command init

Learn the Yii2 framework from scratch (1) Install the Yii2 framework through Composer, yii2composer_PHP tutorial

Test installation results

Enter in the address bar: http://localhost/yii2test/frontend/web/index.php

You will see the following interface:


The installation of Yii2 is now complete. I will follow up on the learning progress of the PHP framework Yii2 later.

The following error occurs when yii2 is installed using composer, please help...

Your php does not enable the mongodb extension~~~~It has nothing to do with Composer

Open your php.ini and enable the mongodb extension (remove the ";" sign in front)

Restart you server (apache, iis...)

Then try again

If it is a Linux system, I don’t know, you can search it

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/866661.htmlTechArticleLearn the YII2 framework from scratch (1) Install the Yii2 framework through Composer, yii2composer I am learning PHP recently and start looking for one A framework to learn quickly. When I first watched the Band of Brothers video...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn