其实这个问题在后来才知道,是composer默认仓库地址被墙的原因,只需要修composer的默认镜像地址即可,
很多朋友在学习Yii2的时候,都要先从网上下载一个Yii2的源码,但是奇怪的是不论是从Github或是Oschina上面拉下来的代码,无论怎样都看不到Vendor目录,这个问题让我痛苦了好久,但是功夫不负有心人,通过学习和研究终于把这家伙给搞下来了,具体的原因貌似是composer镜像地址的原因,我也不是很清楚,有清楚的可以一起聊聊,下面介绍一下具体的步骤,与大家共勉:
一般来说都是通过Composer来安装,关于Composer的一些基础用法在这里不再啰嗦,网上一搜大把大把的,直接上方法
1.线修改composer的镜像地址(就是把默认的镜像地址修改成国内的),打开windows的命令行 输入以下代码
composer config -g repo.packagist composer https://packagist.phpcomposer.com
2.就是按照官方的给的下载方法 输入以下命令
composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-advanced yii2
接着就可以看到熟悉而又亲切的显示(如下)
Installing yiisoft/yii2-app-advanced (dev-master 4ab8ac7d8884e8e959d42c13e8d7cb30ef3475e4)
- Installing yiisoft/yii2-app-advanced (dev-master master): Downloading (100%)
Created project in yii2
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 64 installs, 0 updates, 0 removals
- Installing yiisoft/yii2-composer (dev-master 248f706): Downloading (100%)
- Installing bower-asset/jquery (3.2.1): Downloading (100%)
- Installing bower-asset/inputmask (3.3.8): Downloading (100%)
- Installing ezyang/htmlpurifier (v4.9.3): Loading from cache
- Installing bower-asset/yii2-pjax (v2.0.6): Loading from cache
- Installing bower-asset/punycode (v1.3.2): Loading from cache
- Installing cebe/markdown (dev-master fcc3253): Downloading (100%)
- Installing yiisoft/yii2 (dev-master 31cbccb): Downloading (100%)
- Installing bower-asset/bootstrap (v3.3.7): Loading from cache
- Installing yiisoft/yii2-bootstrap (dev-master 034d570): Downloading (100%)
- Installing doctrine/lexer (dev-master cc709ba): Loading from cache
- Installing egulias/email-validator (2.1.2): Loading from cache
- Installing swiftmailer/swiftmailer (dev-master 1a2f9df): Downloading (100%)
- Installing yiisoft/yii2-swiftmailer (dev-master 76cd85c): Downloading (100%)
- Installing yiisoft/yii2-debug (dev-master e158aea): Downloading (100%)
- Installing bower-asset/typeahead.js (v0.11.1): Loading from cache
- Installing phpspec/php-diff (dev-master 0464787): Loading from cache
- Installing yiisoft/yii2-gii (dev-master 7d60ee3): Downloading (100%)
- Installing fzaninotto/faker (dev-master a8dbabd): Downloading (100%)
- Installing yiisoft/yii2-faker (dev-master ed09cae): Downloading (100%)
- Installing sebastian/version (dev-master 99732be): Loading from cache
- Installing sebastian/resource-operations (dev-master fadc83f): Loading from cache
- Installing sebastian/object-reflector (dev-master 773f97c): Loading from cache
- Installing sebastian/recursion-context (dev-master a0e54bc): Loading from cache
- Installing sebastian/object-enumerator (dev-master 7cfd9e6): Downloading (100%)
- Installing sebastian/global-state (dev-master e8ba02e): Loading from cache
- Installing sebastian/exporter (dev-master 234199f): Loading from cache
- Installing sebastian/environment (dev-master cd0871b): Loading from cache
- Installing doctrine/instantiator (dev-master 7af8066): Downloading (100%)
- Installing phpunit/php-text-template (1.2.1): Loading from cache
- Installing phpunit/phpunit-mock-objects (dev-master 2f789b5): Downloading (100%)
- Installing phpunit/php-timer (dev-master d107f34): Loading from cache
- Installing phpunit/php-file-iterator (dev-master 3cc8f69): Loading from cache
- Installing theseer/tokenizer (1.1.0): Loading from cache
- Installing sebastian/code-unit-reverse-lookup (dev-master 3488be0): Loading from cache
- Installing phpunit/php-token-stream (dev-master 9a02332): Downloading (100%)
- Installing phpunit/php-code-coverage (dev-master 77a1ba8): Downloading (100%)
- Installing sebastian/diff (1.4.x-dev 7f066a2): Loading from cache
- Installing sebastian/comparator (2.0.0): Loading from cache
- Installing webmozart/assert (dev-master 4a8bf11): Loading from cache
- Installing phpdocumentor/reflection-common (dev-master 21bdeb5): Downloading (100%)
- Installing phpdocumentor/type-resolver (0.4.0): Loading from cache
- Installing phpdocumentor/reflection-docblock (4.1.1): Downloading (100%)
- Installing phpspec/prophecy (dev-master c9b8c60): Downloading (100%)
- Installing phar-io/version (1.0.1): Loading from cache
- Installing phar-io/manifest (dev-master 014fead): Loading from cache
- Installing myclabs/deep-copy (1.x-dev 8e6e041): Loading from cache
- Installing phpunit/phpunit (6.2.x-dev ff3a76a): Downloading (100%)
- Installing symfony/yaml (3.4.x-dev a0e1568): Downloading (100%)
- Installing psr/log (dev-master 4ebe3a8): Loading from cache
- Installing symfony/debug (3.4.x-dev 24964d2): Downloading (100%)
- Installing symfony/polyfill-mbstring (dev-master 7c8fae0): Loading from cache
- Installing symfony/console (3.4.x-dev 90e1e86): Downloading (100%)
- Installing stecman/symfony-console-completion (0.7.0): Loading from cache
- Installing behat/gherkin (dev-master 0069ea0): Downloading (100%)
- Installing symfony/dom-crawler (3.4.x-dev 407a9b9): Downloading (100%)
- Installing symfony/css-selector (3.4.x-dev 0fb45a8): Downloading (100%)
- Installing symfony/browser-kit (3.4.x-dev b75564b): Downloading (100%)
- Installing symfony/event-dispatcher (3.4.x-dev 2766c22): Downloading (100%)
- Installing symfony/finder (3.4.x-dev 985b478): Downloading (100%)
- Installing psr/http-message (dev-master f6561bf): Loading from cache
- Installing guzzlehttp/psr7 (dev-master 811b676): Loading from cache
- Installing codeception/base (2.3.x-dev eb3274a): Downloading (100%)
- Installing codeception/verify (0.3.3): Loading from cache
egulias/email-validator suggests installing ext-intl (PHP Internationalization Libraries are required to use the SpoofChecking validation)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/php-code-coverage suggests installing ext-xdebug (^2.5.5)
phpunit/phpunit suggests installing phpunit/php-invoker (^1.1)
phpunit/phpunit suggests installing ext-xdebug (*)
symfony/console suggests installing symfony/process ()
symfony/console suggests installing symfony/lock ()
symfony/browser-kit suggests installing symfony/process ()
symfony/event-dispatcher suggests installing symfony/dependency-injection ()
symfony/event-dispatcher suggests installing symfony/http-kernel ()
codeception/base suggests installing codeception/specify (BDD-style code blocks)
codeception/base suggests installing flow/jsonpath (For using JSONPath in REST module)
codeception/base suggests installing phpseclib/phpseclib (for SFTP option in FTP Module)
codeception/base suggests installing league/factory-muffin (For DataFactory module)
codeception/base suggests installing league/factory-muffin-faker (For Faker support in DataFactory module)
codeception/base suggests installing symfony/phpunit-bridge (For phpunit-bridge support)
Writing lock file
Generating autoload files
O(∩_∩)O哈哈~ 看到这些 意味着您的Yii2已经安装成功了