laravelÔõÑùÉý¼¶
laravel×÷Ϊһ¿îÊ¢ÐеÄphp¿ò¼Ü£¬Ò»Ö±ÒÔÀ´¶¼ÔÚÒ»Ö±µØ¾ÙÐа汾µÄÉý¼¶¡£Ð°汾²»µ«Äܹ»ÓÅ»¯´úÂ룬ÌáÉýÐÔÄÜ£¬°ü¹ÜÇå¾²£¬Í¬Ê±Ò²Äܹ»Ìṩ¸ü¶àµÄ¹¦Ð§£¬ÒÔÖª×㿪·¢ÕßµÄÐèÇó¡£È»¶ø£¬ÔÚÉý¼¶Àú³ÌÖУ¬¿ª·¢ÕßÐèҪעÖØһЩϸ½Ú£¬ÒÔ×èÖ¹·ºÆðÎÊÌâ¡£±¾ÎĽ«ÏêϸÏÈÈÝlaravelÔõÑùÉý¼¶µÄ°ì·¨¡¢×¢ÖØÊÂÏîºÍ³£¼ûÎÊÌâ¡£
1.×¼±¸ÊÂÇé
ÔÚÉý¼¶Laravel֮ǰ£¬ÄúÐèÒª×öһЩ׼±¸ÊÂÇé¡£Ê×ÏÈ£¬ÄúÐèÒª±¸·ÝÄ¿½ñÏîÄ¿µÄ´úÂëºÍËùÓÐÏà¹ØµÄÎļþ¡£Õâ¿ÉÒÔÈ·±£ÔÚÉý¼¶Àú³ÌÖзºÆðÈκÎÎÊÌâʱ£¬ÄúÈÔÈ»¿ÉÒԻعöµ½ÏÈÇ°µÄ°æ±¾¡£Æä´Î£¬ÄúÐèÒª¸üÐÂComposer×Ô¼º¡£ÔÚÏÂÁîÐÐÖÐÔËÐÐÒÔÏÂÏÂÁî¼´¿É£º
composer self-update
µÇ¼ºó¸´ÖÆ
×îºó£¬¼ì²éÄ¿½ñÄúËùʹÓõÄLaravel°æ±¾¡£ÔÚÏÂÁîÐÐÖÐÔËÐÐÒÔÏÂÏÂÁî¼´¿É£º
php artisan --version
µÇ¼ºó¸´ÖÆ
±ðµÄ£¬»¹ÐèÒªÔÚÖÕ¶ËÖнøÈëÄúµÄLaravelÏîÄ¿ËùÔڵĸùĿ¼¡£ÀýÈ磬ÈôÊÇÄúµÄÏîĿĿ¼Ϊ¡°/var/www/html/myproject¡±£¬ÔòÔÚÖÕ¶ËÖÐÔËÐÐÒÔÏÂÏÂÁî¼´¿É£º
cd /var/www/html/myproject
µÇ¼ºó¸´ÖÆ
2.Éý¼¶Ç°¼ì²é
ÔÚ¾ÙÐÐÉý¼¶Ç°£¬ÄúÓ¦¸Ã¼ì²éÄ¿½ñÏîÄ¿ËùʹÓõİ汾ÊÇ·ñÒѾÓÉʱ¡£ÔÚLaravelµÄ¹Ù·½ÎĵµÖУ¬ËûÃÇͨ³£»áÔÚа汾Ðû²¼ºóµÄÊýÈÕÄÚÌṩ¡°Éý¼¶Ö¸ÄÏ¡±£¨Upgrade Guide£©¡£Í¨¹ýÔĶÁÕâЩָÄÏ£¬Äú¿ÉÒÔÏàʶÿ¸öа汾ËùÒýÈëµÄ¸ü¸Ä£¬ÕâЩ¸ü¸Ä¿ÉÄÜ»áÓ°Ïìµ½ÄúÄ¿½ñµÄÏîÄ¿¡£±ðµÄ£¬Äú»¹¿ÉÒÔ¼ì²éÄ¿½ñÏîÄ¿µÄÒÀÀµÏîÊÇ·ñÓë¼´½«ÍƳöµÄа汾¼æÈÝ¡£ÈôÊÇÄúµÄÏîĿʹÓÃÁËһЩµÚÈý·½×é¼þ£¬ÄÇôÄúÐèҪȷ±£ÕâЩ×é¼þÒѾÓëа汾¼æÈÝ£¬»òÕßÐèÒªÔÚÉý¼¶Ö®Ç°¾ÙÐÐÉý¼¶¡£
3.ʹÓÃComposerÉý¼¶
Ò»µ©ÄúÍê³ÉÁËÕâЩ׼±¸ÊÂÇéºÍ¼ì²éÊÂÇ飬׼±¸×îÏÈÉý¼¶ÁË¡£Ê¹ÓÃComposerÉý¼¶LaravelºÜÊǼòÆÓ£¬Ö»ÐèÔÚÖÕ¶ËÖÐÔËÐÐÒÔÏÂÏÂÁî¼´¿É£º
composer update
µÇ¼ºó¸´ÖÆ
Õâ»á¸üÐÂÄúÄ¿½ñÏîÄ¿ËùʹÓõÄËùÓÐ×é¼þ¡¢ÒÀÀµÏî±È¼°×îа汾¡£ÔÚÉý¼¶Ê±´ú£¬Composer»á×Ô¶¯¼ì²éLaravelµÄ°æ±¾£¬²¢ÏÂÔز¢×°ÖÃ×îеİ汾¡£
4.Éý¼¶×¢ÖØÊÂÏî
Ö»¹ÜÉý¼¶LaravelºÜÊÇÈÝÒ×£¬µ«ÔÚÉý¼¶Ê±´ú£¬ÄúÐèҪעÖØһЩÖ÷ÒªµÄÊÂÏî¡£Ê×ÏÈ£¬Çë×ÐϸÔĶÁÉý¼¶Ö¸ÄÏ£¬ÒÔÈ·±£ÄúÒѾÏàʶÿ¸öа汾Ëù°üÀ¨µÄ¸ü¸Ä¼°ÆäÓ°Ïì¡£ÈôÊÇÄúµÄÏîĿʹÓÃÁËһЩµÚÈý·½×é¼þ£¬ÔòÐèҪȷÈÏÕâЩ×é¼þÒѾÓëа汾¼æÈÝ»òÕßÐèÒªÔÚÉý¼¶Ö®Ç°¾ÙÐÐÉý¼¶¡£
Æä´Î£¬ÇëÈ·±£ÔÚÉý¼¶Ö®Ç°±¸·ÝËùÓÐÏà¹ØÎļþ¡£×ÝÈ»ÄúÒѾ×Ðϸ¼ì²éÁËÄúµÄ´úÂ룬ÈÔÈ»¿ÉÄÜ·ºÆðһЩÒâÍâÇéÐΡ£ÈôÊÇÄúûÓб¸·Ý£¬ÄÇôÔÚ±¬·¢ÒâÍâÇéÐεÄÇéÐÎÏ£¬Äú½«ÎÞ·¨»Ø¹öµ½ÒÔÇ°µÄ°æ±¾¡£
³ý´ËÖ®Í⣬»¹ÐèҪעÖØÒÔϼ¸µã£º
ÈôÊÇÄúʹÓõÄÊÇLaravelµÄ¾É°æ±¾£¬ÄÇôÉý¼¶µ½×îа汾¿ÉÄܻᵼÖÂÄúµÄÓ¦ÓóÌÐòÖеÄһЩ´úÂë²»¼æÈÝ¡£ÔÚÕâÖÖÇéÐÎÏ£¬ÄúÐèÒªÔÚÉý¼¶Ö®Ç°×ÐϸÉó²éÉý¼¶Ö¸ÄÏ£¬²¢ÖðÒ»Ð޸ľɴúÂë¡£
ÔÚÉý¼¶ºó£¬ÈôÊÇÄúµÄÓ¦ÓóÌÐòÖб£´æÈκιýʧ»òÎÊÌ⣬Çë²»Òª¾ª»Å£¬ÓÉÓÚÐí¶àÎÊÌⶼ¿ÉÒÔÔÚÉý¼¶ºóÊÖ¶¯½â¾ö¡£ÈôÊÇÄúÓöµ½ÈκÎÎÊÌ⣬ÇëÊ×ÏÈÉó²éLaravelÎĵµ»òÉçÇøÂÛ̳£¬Ñ°ÕÒ×ÊÖú»ò½â¾ö¼Æ»®¡£ÈôÊÇÄúÈÔÈ»ÎÞ·¨½â¾öÎÊÌ⣬ÇëÁªÏµLaravelÖ§³ÖÍŶӾÙÐÐ×ÊÖú¡£
5.³£¼ûÎÊÌâÓë½â¾ö¼Æ»®
ÔÚÏÖʵӦÓÃÖУ¬Éý¼¶Laravel¿ÉÄÜ»áÓöµ½ÒÔϳ£¼ûÎÊÌ⣺
5.1. ±£´æComposerÒÀÀµÐÔ³åÍ»ÎÊÌâ
ÔÚ¸üÐÂLaravelµÄÀú³ÌÖУ¬Äú¿ÉÄÜ»áÓöµ½ComposerÒÀÀµÐÔ³åÍ»ÎÊÌâ¡£ÕâÖÖÇéÐÎÏ£¬ÄúÐèÒªÊÖ¶¯½â¾ö´ËÎÊÌâ¡£
Ê×ÏÈ£¬ÊµÑéÔÚÖÕ¶ËÖÐÔËÐÐÒÔÏÂÏÂÁî²¢ÆÚ´ýÍê³É£º
composer update --no-scripts
µÇ¼ºó¸´ÖÆ
ÈôÊÇComposer¾ÙÐÐÒÀÀµÐÔÆÊÎöʱÓöµ½ÈκÎÎÊÌ⣬Äú¿ÉÒÔʵÑéɾ³ývendorĿ¼²¢ÔËÐÐÒÔÏÂÏÂÁ
composer install
µÇ¼ºó¸´ÖÆ
5.2. ÕÒ²»µ½Ö¸¶¨Èí¼þ°ü
ÈôÊÇÄúÔÚʵÑé¸üлò×°ÖÃLaravelʱÓöµ½¡°ÕÒ²»µ½Ö¸¶¨Èí¼þ°ü¡±ÎÊÌ⣬ÔòÐèÒª¼ì²éÔÚComposerµÄÔ´ÁÐ±í£¨sources£©ÖÐÊÇ·ñÓÐÒ»¸öÓÐÓõÄÔ´±£´æ¡£ÔÚĬÈÏÇéÐÎÏ£¬Composer»á´Ópackagist.orgÏÂÔØÈí¼þ°ü¡£ÈôÊÇÄ¿½ñÔ´²»¿ÉÓã¬ÔòÄúÐèÒªÇл»µ½ÁíÒ»¸öÔ´¡£ÀýÈ磬Äú¿ÉÒÔʵÑéʹÓð¢ÀïÔƵÄÔ´£º
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
µÇ¼ºó¸´ÖÆ
5.3. Ö´ÐÐǨáãʱ·ºÆð¹ýʧ
ÔÚÉý¼¶Laravelºó£¬Äú¿ÉÄÜÐèÒªÔËÐÐÊý¾Ý¿âǨáã¡£ÈôÊÇÄúÔÚÔËÐÐǨáãʱÓöµ½¡°²»¼æÈÝ¡±µÄÎÊÌâ»ò¹ýʧ£¬ÔòÐèÒª¼ì²éSQLÓï¾äºÍÄ£×ÓÀàÊÇ·ñ¼æÈÝ¡£±ðµÄ£¬Äú¿ÉÄÜ»¹ÐèÒª¸üÐÂEloquentÄ£×ÓÒÔ˳ӦеÄÊý¾Ý¿â½á¹¹¡£
5.4. ÎÞ·¨¾ÙÐÐHTTPÇëÇó
ÈôÊÇÄúÔÚÉý¼¶LaravelºóÎÞ·¨¾ÙÐÐHTTPÇëÇó£¬ÔòÓпÉÄÜÊÇÄúʹÓõÄHTTP¿âºÍLaravel²»¼æÈÝ¡£ÔÚÕâÖÖÇéÐÎÏ£¬ÄúÐèÒª¸üÐÂHTTP¿â£¬»òÑ°ÕÒÌæ»»ÒªÁì¡£
6.×ܽá
Laravel×÷Ϊһ¿îÊ¢ÐеÄPHP¿ò¼Ü£¬ÔÚÒ»Ö±¸üкÍÉý¼¶µÄͬʱ£¬Ò²¸ø¿ª·¢Õß´øÀ´Á˸ü¶àµÄÌôÕ½¡£±¾ÎÄÏêϸÏÈÈÝÁËÔõÑùÉý¼¶Laravel£¬°üÀ¨×¼±¸ÊÂÇé¡¢Éý¼¶Ç°¼ì²é¡¢Ê¹ÓÃComposerÉý¼¶¡¢Éý¼¶×¢ÖØÊÂÏîºÍ³£¼ûÎÊÌâ¼°½â¾ö¼Æ»®¡£ÈôÊÇÄúÄܹ»Æ¾Ö¤ÉÏÊö°ì·¨£¬×¼È·µØ¾ÙÐÐLaravelÉý¼¶£¬ÄÇôÄúµÄÓ¦ÓóÌÐò½«Äܹ»»ñµÃÐµĹ¦Ð§¡¢ÐÔÄÜÌáÉýºÍ¸üºÃµÄÇå¾²ÐÔ¡£
ÒÔÉϾÍÊÇlaravelÔõÑùÉý¼¶µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡