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

本书共63小节:

评论 (写第一个评论)