Yii2的安装之composer安装组件

其实这个问题在后来才知道,是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已经安装成功了

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 206,214评论 6 481
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 88,307评论 2 382
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 152,543评论 0 341
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 55,221评论 1 279
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 64,224评论 5 371
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,007评论 1 284
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,313评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,956评论 0 259
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 43,441评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,925评论 2 323
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,018评论 1 333
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,685评论 4 322
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,234评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,240评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,464评论 1 261
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,467评论 2 352
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,762评论 2 345

推荐阅读更多精彩内容