Composer builds Yii development environment

directory (?)[+]

Configure environment variables (can be omitted)

step:

1. Right click on My Computer - Properties - Advanced - Environment Variables

2. Find the Path item (you may need to scroll down to find it), double-click the Path item, and add the path where your PHP directory and class library are located at the end, including the preceding ";" (for example: ;C: \php;C:\php\ext)

3. Click the "New" button and enter "PHPRC" in "Variable Name", and enter the directory where the php.ini file is located in "Variable Value" (for example: C:\php), this step is for windows to find php .ini.

Then follow the installation steps of Yii Chinese website.

1) Install composer first . (Tucao. MD, I have installed it several times and finally installed it. VPN is required. When downloading the installation package downloaded by other browsers, it is easy to report errors, so I still use IE or Edge to download and install it.)

2) Install the Composer asset plugin, which is required to manage bower and npm packages through Composer

E:\wamp\wamp64\www\Yii\yii2-app-advanced>composer global require "fxp/composer-asset-plugin:~1.1.1"
Changed current directory to C:/Users/Administrator/AppData/Roaming/Composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Content-Length mismatch
http://packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date
  - Installing fxp/composer-asset-plugin (v1.1.4)
    Downloading: 100%

Writing lock file
Generating autoload files
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

3) Install Yii in a directory named yii2test, or you can choose any other name.

E:\wamp\wamp64\www\Yii\yii2-app-advanced>composer create-project --prefer-dist  yiisoft/yii2-app-advanced ../yii2test
Content-Length mismatch
http://packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date
Installing yiisoft/yii2-app-advanced (2.0.10)
  - Installing yiisoft/yii2-app-advanced (2.0.10)
    Downloading: 100%

Created project in ../yii2test
Loading composer repositories with package information


  [Composer\Downloader\TransportException]
  Your configuration does not allow connections to http://packagist.org/packages.json. See https://getcomposer.org/do
  c/06-config.md#secure-http for details.


create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--no-install] [--ignore-platform-reqs] [--] [<package>] [<directory>] [<version>]


E:\wamp\wamp64\www\Yii\yii2-app-advanced>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20

4) The last step: initialize our application, the initialization is in the yii2test directory you created, execute the init command in cmd and select 0 yes

E:\wamp\wamp64\www\Yii\yii2test>php yii serve

Warning: require(E:\wamp\wamp64\www\Yii\yii2test/vendor/autoload.php): failed to open stream: No such file or directory in E:\wamp\wamp64\www\Yii\yii2test\yii on line 14

Fatal error: require(): Failed opening required 'E:\wamp\wamp64\www\Yii\yii2test/vendor/autoload.php' (include_path='.;C:\php\pear') in E:\wamp\wamp64\www\Yii\yii2test\yii on line 14
  • 1
  • 2
  • 3
  • 4
  • 5

Something went wrong. . . . . . . . . . . .

Analyze the reasons:

Many people say that the downloaded package is incomplete or the path is wrong when it was created

Well, I'll do it all over again:

Change to the root directory of the project. Execute the creation. During this process, you may be prompted to enter a token. Where is this produced? 
git token setting  can be generated and posted here

E:\wamp\wamp64\www\Yii>composer create-project --prefer-dist  yiisoft/yii2-app-advanced yii2test


  • 1
  • 2
  • 3
  • 4

Wait patiently, you should be prompted to enter the token, paste it on github and wait, it may be slow, there is no way.

After completion, perform the fourth step to initialize the project.

After the installation is successful, visit 
http://127.0.0.1/Yii/yii2test//frontend/web/index.php 
and the template interface will appear.

You can refer to the link below to install 
http://www.yiichina.com/doc/guide/2.0/start-installation

Installation is so annoying, the speed is very slow, and people are tossing

Can't run after clone project

If it is a clone company or an open source project, there is no vendor folder in it. Without this folder, it cannot be run, and it prompts that it cannot find autoload.php or something. 
You need to update the directory where the project is located:

composer update
  • 1

write picture description here 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324686503&siteId=291194637