{"id":22972,"date":"2024-11-21T16:37:22","date_gmt":"2024-11-21T08:37:22","guid":{"rendered":"https:\/\/fwq.ai\/blog\/22972\/"},"modified":"2024-11-21T16:37:22","modified_gmt":"2024-11-21T08:37:22","slug":"laravel%e5%9c%a8mac%e4%b8%8a%e9%9d%a2%e5%ae%89%e8%a3%85","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/22972\/","title":{"rendered":"laravel\u5728mac\u4e0a\u9762\u5b89\u88c5"},"content":{"rendered":"<p>laravel\u662f\u4e00\u4e2a\u4f18\u79c0\u7684php\u6846\u67b6\uff0c\u5e7f\u6cdb\u5e94\u7528\u4e8eweb\u5f00\u53d1\u4e2d\u3002\u5728mac\u4e0a\u5b89\u88c5laravel\u9700\u8981\u4e00\u4e9b\u57fa\u7840\u7684\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u4ee5\u53caphp\u548ccomposer\u7b49\u8f6f\u4ef6\u7684\u652f\u6301\u3002\u672c\u6587\u5c06\u5e26\u9886\u5927\u5bb6\u4e00\u6b65\u6b65\u5b8c\u6210laravel\u5728mac\u4e0a\u7684\u5b89\u88c5\u3002<\/p>\n<h1>\u5b89\u88c5Homebrew<\/h1>\n<p>\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5\u4e00\u4e2aMac\u5305\u7ba1\u7406\u5668\u2014\u2014Homebrew\uff0c\u5b83\u53ef\u4ee5\u8ba9\u6211\u4eec\u66f4\u65b9\u4fbf\u5730\u5b89\u88c5\u548c\u7ba1\u7406\u5404\u79cd\u5e94\u7528\u3002<\/p>\n<p>\u5728\u7ec8\u7aef\u4e2d\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5Homebrew\uff1a<\/p>\n<pre>\/usr\/bin\/ruby -e \"$(curl -fsSL https:\/\/raw.githubusercontent.com\/Homebrew\/install\/master\/install)\"<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528brew\u547d\u4ee4\u6765\u5b89\u88c5\u5404\u79cd\u8f6f\u4ef6\u5305\uff0c\u6bd4\u5982PHP\u3001Composer\u7b49\u3002<\/p>\n<h1>\u5b89\u88c5PHP\u548cComposer<\/h1>\n<p>Laravel\u662f\u57fa\u4e8ePHP\u8fd0\u884c\u7684\uff0c\u6240\u4ee5\u6211\u4eec\u9700\u8981\u5728Mac\u4e0a\u5b89\u88c5PHP\u548cComposer\u3002\u5728\u7ec8\u7aef\u4e2d\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\uff1a<\/p>\n<pre>brew install php<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236    <\/p>\n<pre>brew install composer<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528php -v\u548ccomposer -v\u547d\u4ee4\u6765\u9a8c\u8bc1\u662f\u5426\u5b89\u88c5\u6210\u529f\u3002<\/p>\n<h1>\u5b89\u88c5Laravel<\/h1>\n<p>\u5728\u5b89\u88c5Laravel\u4e4b\u524d\uff0c\u6211\u4eec\u8fd8\u9700\u8981\u5b89\u88c5\u4e00\u4e9b\u6269\u5c55\u5305\u548c\u547d\u4ee4\u884c\u5de5\u5177\u3002<\/p>\n<ol>\n<li>\u5b89\u88c5\u6269\u5c55\u5305<\/li>\n<\/ol>\n<pre>brew install imagemagick<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236    <\/p>\n<pre>brew install php-intl<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u5b89\u88c5\u547d\u4ee4\u884c\u5de5\u5177<\/li>\n<\/ol>\n<pre>composer global require laravel\/installer<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528laravel\u547d\u4ee4\u6765\u521b\u5efa\u548c\u7ba1\u7406Laravel\u9879\u76ee\u3002<\/p>\n<h1>\u521b\u5efaLaravel\u9879\u76ee<\/h1>\n<p>\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Laravel\u9879\u76ee\uff1a<\/p>\n<pre>laravel new myproject<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd9\u4f1a\u5728\u5f53\u524d\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2a\u540d\u4e3amyproject\u7684\u65b0\u9879\u76ee\u3002\u5728\u6267\u884c\u6b64\u547d\u4ee4\u65f6\uff0c\u4f1a\u81ea\u52a8\u4e0b\u8f7dLaravel\u7684\u6838\u5fc3\u4ee3\u7801\u548c\u4f9d\u8d56\u5305\uff0c\u5e76\u4e3a\u6211\u4eec\u521b\u5efa\u597d\u4e00\u4e9b\u9ed8\u8ba4\u7684\u6587\u4ef6\u548c\u76ee\u5f55\u7ed3\u6784\u3002<\/p>\n<h1>\u8fd0\u884cLaravel\u9879\u76ee<\/h1>\n<p>\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8Laravel\u5f00\u53d1\u670d\u52a1\u5668\uff1a<\/p>\n<pre>cd myproject<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236    <\/p>\n<pre>php artisan serve<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cLaravel\u4f1a\u5728http:\/\/localhost:8000\u542f\u52a8\u5f00\u53d1\u670d\u52a1\u5668\u3002<\/p>\n<p>\u73b0\u5728\u6211\u4eec\u53ef\u4ee5\u5728\u6d4f\u89c8\u5668\u4e2d\u8bbf\u95eehttp:\/\/localhost:8000\u6765\u67e5\u770bLaravel\u9ed8\u8ba4\u7684\u6b22\u8fce\u9875\u9762\u4e86\uff01<\/p>\n<h1>\u603b\u7ed3<\/h1>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5728Mac\u4e0a\u5b89\u88c5Laravel\u7684\u5168\u90e8\u6b65\u9aa4\uff0c\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u4f1a\u9047\u5230\u5404\u79cd\u4f9d\u8d56\u548c\u73af\u5883\u95ee\u9898\uff0c\u9700\u8981\u6839\u636e\u9519\u8bef\u63d0\u793a\u8fdb\u884c\u8c03\u6574\u548c\u89e3\u51b3\u3002\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u80fd\u591f\u5e2e\u52a9\u5230\u60f3\u8981\u5728Mac\u4e0a\u4f7f\u7528Laravel\u7684\u5f00\u53d1\u8005\u4eec\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662flaravel\u5728mac\u4e0a\u9762\u5b89\u88c5\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>laravel\u662f\u4e00\u4e2a\u4f18\u79c0\u7684php\u6846\u67b6\uff0c\u5e7f\u6cdb\u5e94\u7528\u4e8eweb\u5f00\u53d1\u4e2d\u3002\u5728mac\u4e0a\u5b89\u88c5laravel\u9700\u8981\u4e00\u4e9b\u57fa\u7840\u7684\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u4ee5\u53caphp\u548ccomposer\u7b49\u8f6f\u4ef6\u7684\u652f\u6301\u3002\u672c\u6587\u5c06\u5e26\u9886\u5927\u5bb6\u4e00\u6b65\u6b65\u5b8c\u6210laravel\u5728mac\u4e0a\u7684\u5b89\u88c5\u3002 \u5b89\u88c5Homebrew \u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5\u4e00\u4e2aMac\u5305\u7ba1\u7406\u5668\u2014\u2014Homebrew\uff0c\u5b83\u53ef\u4ee5\u8ba9\u6211\u4eec\u66f4\u65b9\u4fbf\u5730\u5b89\u88c5\u548c\u7ba1\u7406\u5404\u79cd\u5e94\u7528\u3002 \u5728\u7ec8\u7aef\u4e2d\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5Homebrew\uff1a \/usr\/bin\/ruby -e &#8220;$(curl -fsSL https:\/\/raw.githubusercontent.com\/Homebrew\/install\/master\/install)&#8221; \u767b\u5f55\u540e\u590d\u5236 \u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528brew\u547d\u4ee4\u6765\u5b89\u88c5\u5404\u79cd\u8f6f\u4ef6\u5305\uff0c\u6bd4\u5982PHP\u3001Composer\u7b49\u3002 \u5b89\u88c5PHP\u548cComposer Laravel\u662f\u57fa\u4e8ePHP\u8fd0\u884c\u7684\uff0c\u6240\u4ee5\u6211\u4eec\u9700\u8981\u5728Mac\u4e0a\u5b89\u88c5PHP\u548cComposer\u3002\u5728\u7ec8\u7aef\u4e2d\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\uff1a brew install php \u767b\u5f55\u540e\u590d\u5236 brew install composer \u767b\u5f55\u540e\u590d\u5236 \u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528php -v\u548ccomposer -v\u547d\u4ee4\u6765\u9a8c\u8bc1\u662f\u5426\u5b89\u88c5\u6210\u529f\u3002 \u5b89\u88c5Laravel \u5728\u5b89\u88c5Laravel\u4e4b\u524d\uff0c\u6211\u4eec\u8fd8\u9700\u8981\u5b89\u88c5\u4e00\u4e9b\u6269\u5c55\u5305\u548c\u547d\u4ee4\u884c\u5de5\u5177\u3002 \u5b89\u88c5\u6269\u5c55\u5305 brew install imagemagick \u767b\u5f55\u540e\u590d\u5236 brew install php-intl \u767b\u5f55\u540e\u590d\u5236 \u5b89\u88c5\u547d\u4ee4\u884c\u5de5\u5177 composer global require laravel\/installer \u767b\u5f55\u540e\u590d\u5236 \u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528laravel\u547d\u4ee4\u6765\u521b\u5efa\u548c\u7ba1\u7406Laravel\u9879\u76ee\u3002 \u521b\u5efaLaravel\u9879\u76ee \u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Laravel\u9879\u76ee\uff1a laravel new myproject \u767b\u5f55\u540e\u590d\u5236 \u8fd9\u4f1a\u5728\u5f53\u524d\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2a\u540d\u4e3amyproject\u7684\u65b0\u9879\u76ee\u3002\u5728\u6267\u884c\u6b64\u547d\u4ee4\u65f6\uff0c\u4f1a\u81ea\u52a8\u4e0b\u8f7dLaravel\u7684\u6838\u5fc3\u4ee3\u7801\u548c\u4f9d\u8d56\u5305\uff0c\u5e76\u4e3a\u6211\u4eec\u521b\u5efa\u597d\u4e00\u4e9b\u9ed8\u8ba4\u7684\u6587\u4ef6\u548c\u76ee\u5f55\u7ed3\u6784\u3002 \u8fd0\u884cLaravel\u9879\u76ee \u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8Laravel\u5f00\u53d1\u670d\u52a1\u5668\uff1a cd myproject \u767b\u5f55\u540e\u590d\u5236 php [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-22972","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/22972","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=22972"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/22972\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=22972"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=22972"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=22972"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}