{"id":289,"date":"2018-03-11T00:00:38","date_gmt":"2018-03-10T16:00:38","guid":{"rendered":"https:\/\/cloudbool.com\/archive\/?p=289"},"modified":"2018-03-11T00:00:38","modified_gmt":"2018-03-10T16:00:38","slug":"centos-debian-ubuntu-macos-install-composer","status":"publish","type":"post","link":"https:\/\/cloudbool.com\/archive\/centos-debian-ubuntu-macos-install-composer.html","title":{"rendered":"CentOS\/Debian\/Ubuntu\/macOS\u624b\u52a8\u5b89\u88c5Composer"},"content":{"rendered":"<p>Composer\u662fPHP\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u7c7b\u4f3c\u4e8eDebian\/Ubuntu\u7684apt\uff0cCentOS\u7684yum\uff0c\u73b0\u4ee3PHP\u7a0b\u5e8f\uff0c\u591a\u5c11\u90fd\u4f1a\u7528\u5230\u8fd9\u4e2a\uff0c\u901a\u8fc7\u8fd9\u8d27\uff0c\u6211\u4eec\u80fd\u5f88\u65b9\u4fbf\u7684\u5b89\u88c5\u5404\u4e2a\u6211\u4eec\u6240\u9700\u8981\u7684\u5305\uff0c\u8fd8\u53ef\u4ee5\u7528\u6765\u5b89\u88c5\u4e00\u4e9bPHP\u6846\u67b6\u672c\u8eab\uff0c\u6bd4\u5982\u8bf4Laravel\u3001Lumen\uff0c\u8fd9\u91cc\u8bb0\u5f55\u4e00\u4e0bComposer\u7684\u624b\u52a8\u5b89\u88c5\u65b9\u6cd5\u3002<br \/>\n<!--more--><br \/>\n\u5148\u8bb0\u5f55\u4e00\u4e0b\u5404\u4e2a\u53d1\u884c\u7248\u7528\u5305\u7ba1\u7406\u5668\u5b89\u88c5Composer\u7684\u547d\u4ee4\u3002<\/p>\n<h2>Debian\/Ubuntu\u5305\u7ba1\u7406\u5668\u5b89\u88c5Composer<\/h2>\n<pre><code>apt install composer\n<\/code><\/pre>\n<h2>CentOS\u5305\u7ba1\u7406\u5668\u5b89\u88c5Composer<\/h2>\n<pre><code>yum install epel-release -y\nyum install composer\n<\/code><\/pre>\n<h2>macOS\u5b89\u88c5Composer<\/h2>\n<pre><code>brew install composer\n<\/code><\/pre>\n<p>\u867d\u7136\u5404\u4e2a\u53d1\u884c\u7248\u90fd\u81ea\u5e26\u4e86\u8fd9\u4e2a\u8f6f\u4ef6\u5305\uff0c\u4f46\u662f\u5982\u679c\u76f4\u63a5\u7528\u5305\u7ba1\u7406\u5668\u5b89\u88c5\u7684\u8bdd\uff0c\u56e0\u4e3a\u7cfb\u7edf\u5305\u7ba1\u7406\u5668\u8981\u89e3\u51b3\u4f9d\u8d56\u95ee\u9898\uff0c\u6240\u4ee5\uff0c\u53ef\u80fd\u4f1a\u5b89\u88c5\u4e00\u4e9b\u6211\u4eec\u5e76\u7528\u4e0d\u5230\u7684\u5305\uff0c\u6bd4\u5982\u8bf4CentOS7\u81ea\u5e26\u7684PHP\u662f5.4\uff0c\u5982\u679c\u76f4\u63a5\u7528yum\u5b89\u88c5Composer\u7684\u8bdd\uff0c\u53ef\u80fd\u4f1a\u628aPHP5.4\u7ed9\u987a\u5e26\u5b89\u88c5\u4e0a\uff0c\u800c\u5982\u679c\u6211\u4eec\u7684\u8fd0\u884c\u73af\u5883\u4e0d\u662f5.4\u7684\u8bdd\uff0c\u8fd9\u5c31\u4f1a\u4ea7\u751f\u51b2\u7a81\uff0c\u6240\u4ee5\uff0c\u6211\u4eec\u4e3a\u4e86\u4e0d\u5b89\u88c5\u522b\u7684\u8f6f\u4ef6\u5305\uff0c\u53ef\u4ee5\u9009\u62e9\u624b\u52a8\u5b89\u88c5\u7684\u65b9\u5f0f\u5b89\u88c5Composer\u3002<br \/>\n\u56e0\u4e3aComposer\u4f9d\u8d56PHP\u73af\u5883\uff0c\u6240\u4ee5\u624b\u52a8\u5b89\u88c5Composer\u4e4b\u524d\u53ef\u80fd\u9700\u8981\u914d\u7f6e\u597dPHP\u73af\u5883\uff0c\u7531\u4e8e\u5404\u4e2a\u53d1\u884c\u7248\u5df2\u7ecf\u81ea\u5e26\u4e86PHP\u5305\uff0c\u76f4\u63a5\u5b89\u88c5\u5c31\u884c\uff0c\u5982\u679c\u662fCentOS\uff0c\u60f3\u5b89\u88c5\u4e0d\u540c\u7248\u672c\u7684PHP\uff0c\u53ef\u4ee5\u53c2\u8003\u8fd9\u7bc7\u6587\u7ae0\uff1a<a href=\"https:\/\/cloudbool.com\/archive\/post\/centos6-7-enable-webtatic-repository-yum-install-php-55-56-70-71-72.html\">CentOS6\/7\u4f7f\u7528Webtatic  yum\u5305\u7ba1\u7406\u5b89\u88c5PHP5.5\/5.6\/7.0\/7.1\/7.2<\/a>\u3002<br \/>\n\u5b89\u88c5\u597dPHP\u73af\u5883\u4e4b\u540e\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u624b\u52a8\u5b89\u88c5Composer\u4e86\u3002<\/p>\n<h2>\u624b\u52a8\u5b89\u88c5Composer<\/h2>\n<p>\u5b98\u65b9\u7684\u65b9\u6cd5\u662f\u4f7f\u7528composer-install\uff0c\u53ef\u80fd\u662f\u51fa\u4e8e\u5b89\u5168\u8003\u8651\uff0c\u4f7f\u7528\u4e00\u4e2a\u5b89\u88c5\u811a\u672c\u5b89\u88c5\uff0c\u4e14\u6821\u9a8c\u4e86\u5b89\u88c5\u811a\u672c\u7684SHA384\uff0c\u8fd9\u662fComposer\u7684\u5b98\u65b9\u5b89\u88c5\u6b65\u9aa4\uff1a<\/p>\n<pre><code>php -r \"copy('https:\/\/getcomposer.org\/installer', 'composer-setup.php');\"\nphp -r \"if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;\"\nphp composer-setup.php\nphp -r \"unlink('composer-setup.php');\"\n<\/code><\/pre>\n<p>\u4f46\u662f\uff0c\u5982\u679c\u6211\u4eec\u4e0d\u60f3\u8fd9\u4e48\u9ebb\u70e6\uff0c\u6211\u4eec\u5176\u5b9e\u53ef\u4ee5\u76f4\u63a5\u5b89\u88c5Composer\u672c\u8eab\uff0c\u6b65\u9aa4\u4e5f\u5f88\u7b80\u5355\uff1a<\/p>\n<pre><code>wget https:\/\/getcomposer.org\/composer.phar\nchmod +x composer.phar\nmv composer.phar \/usr\/local\/bin\/composer\n<\/code><\/pre>\n<p>\u8fd9\u6837\u5c31\u7b97\u5b8c\u6210Composer\u4e86\uff0c\u600e\u6837\uff0c\u7b80\u5355\u7c97\u66b4\u5427\uff1f<\/p>\n<h2>Composer\u4f7f\u7528<\/h2>\n<p>\u5b89\u88c5\u5b8c\u4e4b\u540e\uff0c\u6211\u4eec\u6765\u8bd5\u4e00\u4e0bComposer\uff1a<\/p>\n<pre><code>composer -V\n<\/code><\/pre>\n<p>\u5982\u679c\u6b63\u5e38\u7684\u8bdd\uff0c\u5e94\u8be5\u80fd\u770b\u5230Composer\u8f93\u51fa\u7684\u7248\u672c\u4fe1\u606f\u3002<br \/>\n\u5982\u4e0b\u547d\u4ee4\u53ef\u4ee5\u67e5\u770bComposer\u7684\u5e2e\u52a9\u4fe1\u606f\uff1a<\/p>\n<pre><code>composer --help\n<\/code><\/pre>\n<p>update\uff1a\u987a\u4fbf\u8bb0\u5f55\u4e00\u4e0bWindows\u53camacOS\u4e0b\u7684\u5b89\u88c5\u8fc7\u7a0b\u3002<\/p>\n<h2>Windows\u4e0b\u5b89\u88c5Composer<\/h2>\n<p>\u4e4b\u524dComposer\u662f\u4e3aWindows\u63d0\u4f9b\u4e86\u5b89\u88c5\u5305\u7684\uff0c\u73b0\u5728\u8c8c\u4f3c\u4e5f\u53d6\u6d88\u4e86\uff0c\u7edf\u4e00\u7528\u4e0a\u9762\u54ea\u4e2a\u5b89\u88c5\u811a\u672c\u5b89\u88c5\u4e86\uff0c\u6240\u4ee5\uff0c\u5728\u914d\u7f6e\u597dPHP\u4e4b\u540e\uff0c\u53ea\u8981\u6253\u5f00cmd\u7ec8\u7aef\uff0c\u76f4\u63a5\u4f7f\u7528\u4e0a\u9762\u90a34\u884c\u547d\u4ee4\u7528\u5b89\u88c5\u811a\u672c\u5b89\u88c5\u5c31\u597d\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Composer\u662fPHP\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u7c7b\u4f3c\u4e8eDebian\/Ubuntu\u7684apt\uff0cCentOS\u7684yum\uff0c\u73b0\u4ee3PH &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/cloudbool.com\/archive\/centos-debian-ubuntu-macos-install-composer.html\"> <span class=\"screen-reader-text\">CentOS\/Debian\/Ubuntu\/macOS\u624b\u52a8\u5b89\u88c5Composer<\/span> \u67e5\u770b\u5168\u6587 &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"footnotes":""},"categories":[182],"tags":[24,79],"class_list":["post-289","post","type-post","status-publish","format-standard","hentry","category-linux","tag-composer","tag-php"],"_links":{"self":[{"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/posts\/289","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/comments?post=289"}],"version-history":[{"count":0,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/posts\/289\/revisions"}],"wp:attachment":[{"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/media?parent=289"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/categories?post=289"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/tags?post=289"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}