Creating a Yii2 Project
Introduction
Yii
Yii is a high-performance PHP framework suitable for developing Web 2.0 applications.
Yii ships with a rich set of features, including MVC, DAO/ActiveRecord, I18N/L10N, caching, authentication and role-based access control, scaffolding, testing, and more, which can significantly shorten development time.
Creation
Prerequisites
- PHP runtime environment
- Composer environment
Mac OS X
1
brew install composer
Ubuntu
1
2
3
4
5
6
7
8# Download
curl -sS https://getcomposer.org/installer | php -d detect_unicode=Off
# Make it global
mv composer.phar /usr/local/bin/composer
# Permissions
chmod a+x /usr/local/bin/composer
# Update
composer self-update
Installation
Install via Composer
Install the composer-asset-plugin.Install the basic edition.1
2
3
4# Switch to the China mirror (http://pkg.phpcomposer.com/)
composer config -g repo.packagist composer https://packagist.phpcomposer.com
composer global require "fxp/composer-asset-plugin:^1.2.0"Install the advanced edition.1
composer create-project yiisoft/yii2-app-basic xxx
1
composer create-project yiisoft/yii2-app-advanced xxx
Download and install
Basic edition
Advanced edition
Tips
1 | The zip extension and unzip command are both missing, skipping. |
Solution
1 | apt-get install php7.0-zip |
1 | codeception/base 2.2.3 requires phpunit/phpunit >4.8.20 <5.5 -> satisfiable by phpunit/phpunit |
Solution
1
apt-get install php7.0-xml