composerÎÞ·¨×°ÖÃlaravelÔõô°ì
ÔÚʹÓÃlaravel¾ÙÐпª·¢Ê±£¬ÎÒÃǾ³£»áʹÓÃcomposerÕâ¸öphpµÄ°ü¹ÜÀíÆ÷À´×°Öú͸üÐÂÎÒÃǵÄÒÀÀµ¡£È»¶ø£¬ÔÚʹÓÃcomposer×°ÖÃlaravelʱ£¬¿ÉÄÜ»áÓöµ½ÎÞ·¨×°ÖõÄÇéÐΡ£
±¾ÎĽ«Ì½ÌÖһЩ¿ÉÄܵ¼ÖÂComposerÎÞ·¨×°ÖÃLaravelµÄÔµ¹ÊÔÓÉ£¬²¢ÌṩһЩ½â¾ö¼Æ»®¡£ÈôÊÇÄãÕýÔÚÓöµ½ÏàͬµÄÎÊÌ⣬ϣÍû±¾ÎÄÄܹ»×ÊÖúÄã½â¾ö¡£
ÍøÂçÅþÁ¬ÎÊÌâ
Ê×ÏÈҪȷÈϵÄÊÇ£¬Composer×°ÖðüʱÐèÒªÅþÁ¬ÍⲿÍøÂçÏÂÔØ£¬ÈôÊÇÄãµÄÍøÂç²»Îȹ̻òÕß±£´æ·À»ðǽ£¬Ôò¿ÉÄܻᵼÖÂComposerÎÞ·¨ÏÂÔØ×°Öðü¡£´Ëʱ£¬¿ÉÒÔʵÑéÔÚÖÕ¶ËÖÐʹÓÃcurl»òwgetÏÂÔØÏìÓ¦µÄLaravel×°Öðü£¬È»ºóÊÖ¶¯×°Öá£Ïêϸ°ì·¨ÈçÏ£º
·¿ªÖն˻òÏÂÁîÐд°¿Ú£»
ʹÓÃcurl»òwgetÏÂÁîÏÂÔØLaravel×°Öðü£¬ÀýÈ磺
curl -s https://getcomposer.org/installer | php php composer.phar create-project --prefer-dist laravel/laravel your-project-name
µÇ¼ºó¸´ÖÆ
»ò
wget http://getcomposer.org/composer.phar php composer.phar create-project --prefer-dist laravel/laravel your-project-name
µÇ¼ºó¸´ÖÆ
ÔËÐÐÉÏÃæµÄÏÂÁîʱ£¬½« your-project-name Ì滻ΪÄãµÄÏîÄ¿Ãû³Æ£»
ÔËÐÐÏÂÁîºó£¬ÆÚ´ýComposerÏÂÔز¢×°ÖÃÒÀÀµ¡£
Composer°æ±¾ÎÊÌâ
ÈôÊÇÄãÒѾÀÖ³É×°ÖÃÁËComposer£¬µ«ÈÔÈ»Óöµ½ÎÞ·¨×°ÖÃLaravelµÄÎÊÌ⣬ÄÇôÇëÈ·ÈÏÄãʹÓõÄComposer°æ±¾ÊÇ·ñ×㹻С£Ê×ÏÈҪȷÈÏÄãµÄComposer°æ±¾£¬¿ÉÒÔͨ¹ýÖն˻òÏÂÁîÐд°¿ÚÊäÈë composer -V À´Éó²é¡£
ÈôÊÇÄãµÄComposer°æ±¾µÍÓÚ 1.9.0£¬Ôò¿ÉÄܻᵼÖÂÎÞ·¨×°ÖÃLaravel¡£ÈôÊÇÊÇÕâÖÖÇéÐΣ¬½¨ÒéÉý¼¶µ½×îа汾¡£Éý¼¶ÒªÁìÈçÏ£º
·¿ªÖն˻òÏÂÁîÐд°¿Ú£»
ÊäÈëÒÔÏÂÏÂÁ
composer self-update
µÇ¼ºó¸´ÖÆ
ÆÚ´ýÉý¼¶Íê³Éºó£¬ÔÙ´ÎʵÑé×°ÖÃLaravel¡£
PHPÀ©Õ¹ÎÊÌâ
ÔÚ×°ÖÃLaravel֮ǰ£¬ÐèÒªÏÈÈ·ÈÏÄãµÄϵͳÉÏÊÇ·ñÒѾװÖÃÁ˱ØÐèµÄÀ©Õ¹¡£ÈôÊÇûÓÐ×°ÖÃÕâЩÀ©Õ¹£¬Ôò¿ÉÄܻᵼÖÂ×°ÖÃLaravelʧ°Ü¡£
ÐèҪװÖõÄPHPÀ©Õ¹°üÀ¨£º
OpenSSL À©Õ¹
PDO À©Õ¹
Mbstring À©Õ¹
Tokenizer À©Õ¹
ÔÚ´ó´ó¶¼LinuxϵͳÉÏ£¬¿ÉÒÔʹÓÃapt¡¢yumµÈ°ü¹ÜÀíÆ÷À´×°ÖÃÕâЩÀ©Õ¹£¬ÀýÈ磺
sudo apt install php-openssl php-pdo php-mbstring php-tokenizer
µÇ¼ºó¸´ÖÆ
ÔÚ×°ÖÃÍê³ÉÕâЩÀ©Õ¹Ö®ºó£¬ÔÙʵÑé×°ÖÃLaravel¡£
Laravel°æ±¾²»Æ¥Åä
ÈôÊÇÄãÔÚ×°ÖÃLaravelʱ£¬Ö¸¶¨ÁËLaravel°æ±¾ºÅ£¬ÔòҪȷÈÏÄãÖ¸¶¨µÄ°æ±¾ÊÇ·ñ±£´æ¡£Äã¿ÉÒÔÔÚLaravelµÄ¹Ù·½ÍøÕ¾ÉÏÕÒµ½Laravelÿ¸ö°æ±¾µÄÐÅÏ¢ºÍ¿ÉÓÃÐÔ£¬È·±£ÄãÑ¡ÔñµÄ°æ±¾ÊÇ¿ÉÓõġ£ÈôÊÇÄãûÓÐÖ¸¶¨°æ±¾£¬ÔòĬÈÏ×°ÖÃ×îа汾µÄLaravel¡£
composer.json ÎļþÎÊÌâ
×îºó£¬ÈôÊÇÄãµÄComposerÎÞ·¨×°ÖÃLaravel£¬Ò²¿ÉÒÔ¼ì²éÄãµÄcomposer.jsonÎļþÊÇ·ñ׼ȷ¡£ÔÚ´ó´ó¶¼ÇéÐÎÏ£¬ÎÞ·¨×°ÖÃLaravelµÄÔµ¹ÊÔÓÉÊÇÓÉÓÚcomposer.jsonÎļþÖеĹýʧ»òȱʧ£¬ÀýÈ磺
ûÓÐÖ¸¶¨Laravel°ü£»
Ö¸¶¨µÄLaravel°ü°æ±¾ºÅ¹ýʧ£»
Ö¸¶¨µÄÒÀÀµ°ü°æ±¾ºÅÌ«µÍ£»
ÒÀÀµ°ü°æ±¾ºÅÃûÌò»×¼È·µÈ¡£
Òª½â¾öÕâЩÎÊÌ⣬¿ÉÒÔ¼ì²éÄãµÄcomposer.jsonÎļþ£¬²¢Æ¾Ö¤ÐèÒª¾ÙÐиüÕý¡£Ïêϸ°ì·¨ÈçÏ£º
·¿ªcomposer.jsonÎļþ£»
È·ÈÏ “laravel/framework” ÊÇ·ñÔÚ “require” ÁбíÖУ»
È·ÈÏÊÇ·ñÉèÖÃÁË׼ȷµÄLaravel°æ±¾ºÅ£¬ÀýÈç”laravel/framework”: “^8.0″£»
È·ÈÏÆäËûÒÀÀµ°üµÄ°æ±¾ºÅÊÇ·ñ׼ȷ£»
ÉúÑÄcomposer.jsonÎļþ£¬²¢ÔÚÖն˻òÏÂÁîÐд°¿ÚÖÐÔËÐÐÒÔÏÂÏÂÁ
composer update
µÇ¼ºó¸´ÖÆ
ÆÚ´ýComposer¸üÐÂÒÀÀµ°ü£¬²¢ÊµÑéÖØÐÂ×°ÖÃLaravel¡£
×ܽá
ÔÚʹÓÃLaravel¾ÙÐпª·¢Ê±£¬ÈôÊÇÄãÓöµ½ÁËComposerÎÞ·¨×°ÖÃLaravelµÄÎÊÌ⣬ÄÇôÕâЩ½â¾ö¼Æ»®¿ÉÄÜ»á°ïµ½Ä㣺
È·ÈÏÍøÂçÅþÁ¬ÊÇ·ñÕý³££»
È·ÈÏComposer°æ±¾ÊÇ·ñ¹»Ð£»
È·ÈÏϵͳÖÐÊÇ·ñÒÑ×°ÖñØÐèµÄPHPÀ©Õ¹£»
È·ÈÏÑ¡ÔñµÄLaravel°æ±¾ÊÇ·ñ±£´æ£»
¼ì²écomposer.jsonÎļþÊÇ·ñ׼ȷ¡£
ÒÔÉϾÍÊÇcomposerÎÞ·¨×°ÖÃlaravelÔõô°ìµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡