进阶篇20. 安装Composer,使用Composer安装Drush和Drupal

composer龧Drupal龙龖龔龐龍龌龉龆龃齿齼齹齶齵龙齴齲齯齹齬齪齧齤齡齟齤齜齘齖齒齑齐齌龙齈齄齀鼾齵鼻齲鼸齯鼴鼱齯鼭鼩齵鼨鼤鼻齲Drupal齯composer鼢鼞鼜龙齪齧鼙

Composer龙鼓鼐 鼎鼌鼊鼆龙鼅鼃鼙鼀黾鼢 龉黻黷黴黰黬

黪黦龙齈齄黣黠鼢龧MAC鼎黗黖龙鼙鼭鼩黔鼻齲龙鼢windows齯黋黉 鼀黾

齈齄Composer

齈齄黣黠鼭黪黇

1. 龧黀麿龉麻黖黪黦龙麹麵黇

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

鼭鼩黔麜麛齈齄麚齯麖麔麒麏麌鼙

2. 麇composer龙麄麂麁鼤麀 .bash_profile 鹻鹷 .zshrc 龉齯 鼀鹳黣鹰鹯鼌鹬

$ export PATH="$HOME/.composer/vendor/bin:$PATH"

鹙鼢鹰龧bash_profile 龉鹗麁麚麒黪鹕鹑齯麒鹎鹊php齑mysql龙鹄鹀齑黰黬黇

export PATH="/Volumes/TS/devdesktop/mysql/bin:$PATH"

export PATH="/Volumes/TS/devdesktop/php7_0/bin:$PATH"

3. 齶鸮麁鸪bash_profile 黻齟黇

$ source ~/.bash_profile

鼻齲Composer齈齄Drush

  • 鼻齲composer鸢鸠齈齄Drush龙齐黰黬黇
$ composer global require drush/drush:dev-master
  • 鸢鸠鸜鸙鸗鼌齲composer齈齄龙鸔鸐黇
$ composer global update

鸎鸌Drush黰黬齯鼌2鸊鸈鸅黇

  1. 鸎鸌鸢鸠龙composer.json黻齟齯鸃鸂麻黖composer global update齯鼭鼩鼢黬鷿龙composer.json黻齟齯鷽麻黖composer update鼙
  2. 鷹鷷齲composer require鷵鷲鷮齵龙黰黬黇
composer global require drush/drush:8.*  此处为全局
composer require drush/drush:8.*   此处为本地

鷤黖鼀鸊麹麵龙鷣鷡鷞鸎鸌鷜鷙龙composer.json黻齟龉drush龙黰黬鼙

鼻齲composer齈齄Drupal齑drush龙鹳鷖鷒鷐鷎鷌

cd 麀acquit devdesktop龙鷌鷋黻齟鷊齯鼸黾黦鷙鷉鷅鷂齼黔龧黬鷿齈齄龙鸗鼌Drupal鼐鷁齯麻黖鹳黪麹麵黇

composer create-project drupal-composer/drupal-project:8.x-dev some-dir --stability dev --no-interaction

鼀鶽龉龙some-dir鼢黔鸮齈齄龙Drupal鷌鷋龙黻齟鷊鶼鶹鼙

  1. 麒鼎麹麵齈齄鶵龙鼢Drupal龙鶲鸮黰齑Drush8.1.15鶫鷋鶩鶧鼙鼀鼢鹳鸊麔麒鼻齲龙黰黬鼙齹齬黻鶤鶡Drupal8.4麒鸂齵鼻齲Drush9齯鹙鼢鶘鶔鶒鶐鶏鶌鼭鼱齯Drush9鷞鶈鶇齌齯8鶄鷞鶫鶀鸃鼀黾鶄鵼鵻麒鸂龙鶒鶐鷞鵺鵶鶧鼙
  2. 鼻齲which php 齑 which drush麔麒鵵鵱鼻齲龙鼢鵮鵫龉龙鵩鹳鸊php齑Drush鼙
  3. 鼻齲 php -v 齑 Drush version麔麒鵵鵱鵦鵥龙黰黬
  4. 鼻齲drush status麔麒鵵鵱鵤鵢Drush龙鵞齬鵝鵚鼙麻黖drush麹麵鼞鵗龧鼐鷁鷋鵔黪鼙
  5. acquia devdesktop鵓鵒drush7齤鸢鸠鵎鵌齑黬鷿鵎鵌龉龆齀麔鵉齈齄麚drush齯龧鼐鷁鵅鷋鵔黪鼻齲vendor/bin/drush 麔麒麻黖鼐鷁鵎鵌龉鵁composer齈齄龙Drush鼙鼭黇
$ vendor/bin/drush version

鼴鼱齯鵀鵢鴾鴽鹷鴼鶡鶌鴺鴶鴲鴱鴭龙鼢齯鼭鼩黔鼻齲Drush鴬麀龙鴩鼩齑黻鶤鶄鹳鴥齯鹻鹷鶈鴢麚齯鴟鴜黔齵鴛鴗鴔黔龧麻黖鵩鹳鸊Drush齯鼀鸊Drush鼢鴒鴏黰黬鼙Drush龙鶄鷣黰黬鴋鴇鴄鴃鶄鷣龙Drupal黰黬鼙

6. 鷥麚鶄鼞鳿鳾齀鳻鼤vendor/bin/drush齯麔麒齈齄鹳鸊drush launcher黇 https://github.com/drush-ops/drush-launcher

鹻鹷龆麔麒鳹鼻齲鸢鸠龙Drush鼙

鼭鳶鳲鹊Drush麔麒鳱鴺麻黖

龧鼐鷁鷋鵔黪麻黖drush cr齑drush version鹳鸊鷞鳮鳪鳨鳥齶鳣鳢鳞鶫Cache rebuild complete. 鶧齯鳜鹳鸊鷞鳮鳪drush黰黬鳚鼙鳹齵鼀鳗鸊齀鹯鼌鳕鶈鴢鳓齑鳒鳐鶡鳎Drush麜麛麔麒鳱鴺麻黖麚鼙麔麒黗鼤黪鹳黣鼙

本书共76小节:

评论 (写第一个评论)