1. 自动加载器与Composer

自动加载器

drupal8龧龣龟龛龙龕龒龑龐龍龌龣龊龉龅龂龌龣龊龉龅龑齿齼齻齸齴齱龑齰齼齮齭龟齴

齩齨齥齣齢龟php齜齙齘齔龟齒齐龂齌齊齈齇龙齃齀齣齢鼼鼹齌鼸龊龉齀鼶鼲鼮鼭龂鼩php齔鼧鼥鼣鼠鼝鼚齀鼶鼲鼮鼭齒龂鼥鼗鼕鼒鼐鼍鼋龂齱鼕鼇龙齃鼅鼄鼀齨黾黺黶黴鼀齨鼶鼲龟黲黯黬黨黧黣龂黢黟齩黛齃黗齜黖齀鼶鼲鼮鼭黓龊龉黏龂鼼黋黇黅黄齊齈齇齣齢龂齜齙黃黀鼣鼠麾麼龟黅黄麹麵龂麱鼼齜齙鼍鼋龂麯齼黛齃鼅鼄鼀齨龟黲黯黬黧黣龑齰齼麮龟麬齴齱龑麪黴麦鼶鼲麤龂麢麡麝黗spl_autoload_register麄麃麂鹾鹺鼇龟龂黛龒龑php龟龌龣龊龉鹸鹷龂spl_autoload_register麄麃龟鹵黴黧黣鹴鹲 http://www.php.net/manual/zh/function.spl-autoload-register.php

drupal8龒鹵黴黏黛齃龌龣龊龉鹸鹷龂齩齊齈齇鹘齃齣齢龟齒齐龂php麝黗齀龟鹔鹒鹏鼶鹌鹋麄鹈鹌鹅鹄鹀鸿鸽龟齀鹌麃鸼鼮鼭鸺鸸龟齣鸷鸵鸳龌龣鼇 include鼮鼭龂黛齃鸯鸭黓鸫鸧齩龙齃齣齢鼀齨鹔鸥龂黛齃齣齢龟齀鼶鼲鼮鼭鸣鸠\vendor\composer\ClassLoader.php

齩\vendor\composer\鼮鼭鸏鸌鸈鼕鸇鸼黢鸌鸅齃鼮鼭鸄

autoload_classmap.php 鼀齨龑齀鸼齀鼶鼲鼮鼭龟鸀鷼鸵鸳鷻

autoload_files.php 鼀齨龑鹒鷸鼹齌龊龉龟黲黯

autoload_namespaces.php 鼀齨龑 PSR0 鸀鷼鸵鸳

autoload_psr4.php 鼀齨龑 PSR4 鸀鷼鸵鸳

ClassLoader齀齣齢龒龑鷬鷩鼀齨鼶鼲龟鷨鷦齣鸷鸵鸳鼇鷥鷣黲黯鷢齀鼶鼲鼮鼭龂齩齜齙鷟麵麡鷞黃黀龣鷝龟鷜龊黛鷚鸀鷼鸵鸳鹺鼇

齊齈齇龊龉龅麡麄齊齈齇黗齜黖鷗鷓齥spl_autoload_register麂鹾黏麃龂drupal8龒鼗鼹齌鷏龣龟 include龙鷋鷊鼮鼭黏龂鷆鼇黏鷋鷃鸯鸭龂鷁鸼黛鼀鸈鸷鶿鶽鶼黏齿齼龑龌龣龊龉龅鷢齱龟鶹鶷鶶

黢黟鸈鸇黗drupal8龟index.php鼮鼭黃鶳鼕鶰鶯鶭齿齼齌黖鶩鸅黺鶧鸼\vendor\composer龂鶦齊龑鶣鶭\vendor\composer鼀齨龟鼮鼭龑龌龣齭鸥龟龂鶟鶝\vendor鶛鶙鼀齨龟鶘鼠鼮鼭鶕龑龌龣齭鸥龟麄vendor鼀龑drupal8黴鸼龟鶘鼠龛鶒黧齜齙鶑麃龂黛龑齰齼黇鶐齴龑鶍齭鸥黏鶋鶊齴鶈龒龑鷋鹌鶄鶄龟composer

Composer

composer黓黴鸠php齜齙龟黾鶂鶁鶷龂鵾鵻鵸鷁龒龑鼧鵶php鵴鶛黬鵲黬鵮鼕黴鸼龛鶒黧齜齙鶑龂麯齼黢鵭鵫鵨龛鶒黧鶑龟鵥鵤齴黢鵭鸌龉齴鵲齃鵠鸭黨黢鵭鵫鵨鵜鷦鵛龙齴龛鶒黧鶑鵘鵗鵔黾鶂黬鵲鵑黾鶂齰齼鵏鶷齴黛鼹齌龙齃龌龣齇龟鵎鵋黧鵈龂鸠龑composer齮齭黏

composer黴鸠鵎鵋鵇鵄麾麼龂齱鷦鵀龑龙齃黴php鴽鸥龟鸷黴齜齙龂黓鸫鸧鸥黏composer.phar龂鷟麵齩php鴻鵇龂鴺鴶鸈鸌龉龛鶒黧鴳鼭鶑龂鵫鵨鵜鷦鵛龙龂齮齭龌龣龊龉龅龟鴲鵶鴮鴬鴬龂drupal8龟\vendor鶛鶙龒龑鶋龌龣齮齭龟鶶鸌齨鴫鶊麮鴪鴩龙鸌齱龟黴黣鸄

鼸鴨鸧composer龂鶘鴥鴨鸧鶦齊龒龑鸌龉齱龟麹麵鼮鼭composer.phar龂黢黟鼹齌黧鴡龙鵸鴞鴛齱龊鴗鴔鸭鸳鵛龟鴐鴌鴋鷃龂黛鼀鶭鴊鵄黧鴡龂鴆鼶鸈鹵黴龟龑window鸳鵛龂php鷗鷓黓鷜龊鸼鴐鴌鴋鷃黖龂composer.phar鴃鼹鷜龊鸼鴐鴌鴋鷃黖龂齊鴀鶛鶙鶭C:\root\test\composer鸄

鳾鼸鸌龉composer.phar龂 鳻鳸 鼠鸅鷚鴨鸧黧鳶龂黃黀黴鳲鳯麵鴨鸧龂鳬黃黀鳫鳨鸌龉龂鳧齘 https://getcomposer.org/download/ 鷥鸇鳦齨鳢鳞龂Manual Download鷏龣鸌龉龂鳖鳕鳔鵤龟龙齃鵜鷦龂鸌龉鵫鳑鸼C:\root\test\composer黖鶶

composer龑麝黗composer.json鼮鼭麮鵎鳋鼥龌龣鸌龉龛鶒黧鶑龟龂鸌龉鹔鸥鼕齭鸥龙齃composer.lock鼮鼭龂黴鸠鳅鼶鵠鳂齘齔黨龟龛鶒黧鵜鷦龂鸵鸠composer.json齰齼鹷鸭麯龑鹵黴龛鶒黧鶑龟鵴鶛齘齔黨龟鲿鲼龂鹴鲹鲷鳻黧鼮鲳龂黛鼀鲯鹷drupal8鲫鶛鶙龟composer.json鲨composer.lock鲨core鼮鼭鸏鸼C:\root\test\composer黖龂鳧齘鳲鳯麵,齘鲦鲤鵻>cmd鹴鲡鵫php黓鷜龊鸼黏鸳鵛鴐鴌鴋鷃龂鷟麵鲝鴶鲙鲗鲖龟鳲鳯鸄

鶟齒齜齙齘鲦鸌龉龛鶒黧鶑龂鼥齮齭龌龣龊龉龅龂鵲鲒龙齃C:\root\test\composer\vendor鶛鶙龂鹺鼇鸇龙鸇龂齣鲑龙鸌鸠drupal8鲫鶛鶙鸌齨龟\vendor龑鼗龑龙鲍龙鲋麬齴

鸵鸠composer龟鵥鵲鲇鲄鹴鸼鳻黧鳸鲀 https://getcomposer.org/

    cd C:\root\test\composer  
    php composer.phar  install 

晴空注:关于Composer的延伸阅读资料:

 

D.O.: Using Composer with Drupal

Pantheon:Using Drupal 8 and Composer

Jeff Geerling:Tips for Managing Drupal 8 projects with Composer 及 

Composer and Drupal are still strange bedfellows

本书共83小节:

评论 (写第一个评论)