Home >PHP Framework >YII >How to install yii framework?

How to install yii framework?

青灯夜游
青灯夜游Original
2019-12-23 18:01:263306browse

Yii is a high-performance PHP5 web application development framework. A simple command line tool yiic can quickly create a web application code framework. Developers can add business logic based on the generated code framework to quickly complete application development.

How to install yii framework?

#How to install the yii framework?

We can install Yii through Composer.

#Composer is a dependency management tool for PHP5.3 and above. It allows you to declare the code libraries your project depends on and it will install them for you in your project. Composer is not a package manager. Yes, it involves "packages" and "libraries", but it's managed on a per-project basis, with installations in some directory within your project (e.g. vendor). By default it won't install anything globally. So this is just a dependency management.

Steps:

1. Install Composer

If Composer has not been installed, you can press getcomposer.org method to install.

In Linux and Mac OS X you can run the following command:

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

In Windows, you need to download and run Composer-Setup.exe.

If you encounter any questions or want to learn more about Composer. If you have Composer installed, make sure you are using the latest version. You can use the composer self-update command to update Composer to the latest version.

All composer commands assume that you have installed composer globally so that it can be used as a composer command. If you are using composer.phar in a local directory, you must adjust the example commands accordingly.

If you have installed Composer before, make sure to use the latest version. You can update Composer by running composer self-update.

2. Install Yii

After installing Composer, you can install the Yii application template by running the following command in a web-accessible folder:

composer create-project --prefer-dist yiisoft/yii2-app-basic basic

This will install the latest stable version of the Yii application template in a directory called basic. You can choose a different directory name if needed.

Tips: If you want to install the latest development version of Yii, you can use the following command instead, which adds a stability option

composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic

Please note that the development version of Yii Should not be used in production as it may break your running code.

Recommended learning: Yii introductory tutorial

The above is the detailed content of How to install yii framework?. For more information, please follow other related articles on the PHP Chinese website!

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
Previous article:What is yii2.0?Next article:What is yii2.0?