{"id":6136,"date":"2018-03-29T13:00:12","date_gmt":"2018-03-29T04:00:12","guid":{"rendered":"https:\/\/tadtadya.com\/en\/?p=6136"},"modified":"2021-01-25T14:13:47","modified_gmt":"2021-01-25T05:13:47","slug":"php-how-to-install-composer","status":"publish","type":"post","link":"https:\/\/tadtadya.com\/en\/php-how-to-install-composer\/","title":{"rendered":"PHP, How to install composer"},"content":{"rendered":"\n<p>PHP composer is a command tool to manage packages.<\/p>\n\n\n\n<p>It is absolutely necessary in the development of PHP programs. We will show you how to install the composer in a simple way with samples and captures.<\/p>\n\n\n\n<!--more-->\n\n\n\n<div class=\"wp-block-origin-block-msg-box\"><div class=\"msgbox msgbox-notice v1\"><i class=\"fas fa-exclamation-triangle icon\"><\/i><div class=\"msg\">\n<p>This is written by a Japanese who can't speak English with the help of translation application. Sorry if it's not good.<\/p>\n<\/div><\/div><\/div>\n\n\n<div id=\"toc\" class=\"idx-lst\">\n\t<input type=\"checkbox\" class=\"chk\" id=\"idx-lst-chk\" name=\"btn\" \/>\n\t<label class=\"idx-lst-hd\" for=\"idx-lst-chk\"><i class=\"fa-solid fa-check-double\"><\/i>Contents<\/label>\n\t<div class=\"idx-lst-bd\">\n\t\t<ul class=\"idx-lst-ul\">\n\t\t\t\t\t\t\t<li class=\"idx-lst-li idt0\">\n\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa-regular fa-hand-point-right ico\"><\/i>\n\t\t\t\t\t\t\t\t\t\t<a href=\"#index-list-1\" title=\"Download composer.phar file\">Download composer.phar file<\/a>\n\t\t\t\t<\/li>\n\t\t\t\t\t\t\t\t<li class=\"idx-lst-li idt0\">\n\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa-regular fa-hand-point-right ico\"><\/i>\n\t\t\t\t\t\t\t\t\t\t<a href=\"#index-list-2\" title=\"How to install composers in Windows10\">How to install composers in Windows10<\/a>\n\t\t\t\t<\/li>\n\t\t\t\t\t\t\t\t<li class=\"idx-lst-li idt0\">\n\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa-regular fa-hand-point-right ico\"><\/i>\n\t\t\t\t\t\t\t\t\t\t<a href=\"#index-list-3\" title=\"How to install composers in CentOS\">How to install composers in CentOS<\/a>\n\t\t\t\t<\/li>\n\t\t\t\t\t\t\t\t<li class=\"idx-lst-li idt1\">\n\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa-regular fa-hand-point-right ico\"><\/i>\n\t\t\t\t\t\t\t\t\t\t<a href=\"#index-list-4\" title=\"Creating the composer command\">Creating the composer command<\/a>\n\t\t\t\t<\/li>\n\t\t\t\t\t\t\t\t<li class=\"idx-lst-li idt1\">\n\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa-regular fa-hand-point-right ico\"><\/i>\n\t\t\t\t\t\t\t\t\t\t<a href=\"#index-list-5\" title=\"Composer command path settings\">Composer command path settings<\/a>\n\t\t\t\t<\/li>\n\t\t\t\t\t\t\t\t<li class=\"idx-lst-li idt0\">\n\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa-regular fa-hand-point-right ico\"><\/i>\n\t\t\t\t\t\t\t\t\t\t<a href=\"#index-list-6\" title=\"Checking for installation\">Checking for installation<\/a>\n\t\t\t\t<\/li>\n\t\t\t\t\t\t<\/ul>\n\t<\/div>\n<\/div>\n\n\n\n\n<p>The composer command is not included by default in PHP. It needs to be installed separately. The first step is to download the composer.<\/p>\n\n\n\n<h2 class=\"is-style-h2df\" id=\"index-list-1\">Download composer.phar file<\/h2>\n\n\n\n<p>Composer installation is configured after downloading the composer.phar file.<\/p>\n\n\n\n<p>composer.phar is retrieved from '<strong><a href=\"https:\/\/getcomposer.org\/download\/\" title=\"https:\/\/getcomposer.org\/download\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/getcomposer.org\/download\/<\/a><\/strong>'.<\/p>\n\n\n\n<p>Windows has an installer (Composer-Setup.exe). You can get it from the earlier URL.<\/p>\n\n\n\n<p>The site tells you how to download and install it from the command line. You can also download composer.phar by yourself.<\/p>\n\n\n\n<p>Downloading and installing on the command line is the same as on the site, so we will skip it here and just download composer.phar the way it is.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/i0.wp.com\/tadtadya.com\/wp-content\/uploads\/2018\/01\/php-composer-install-1.png?ssl=1\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/i0.wp.com\/tadtadya.com\/wp-content\/uploads\/2018\/01\/php-composer-install-1-700x402.png?resize=700%2C402&#038;ssl=1\" alt=\"php composer install \u30ad\u30e3\u30d7\u30c1\u30e3 1\" class=\"wp-image-5576\" data-recalc-dims=\"1\"\/><\/a><\/figure><\/div>\n\n\n\n<p>Download from the link for the version number you want to use.<\/p>\n\n\n\n<p>When downloading on the command line, get the linked URL of the version number and run the command.<\/p>\n\n\n\n<div class=\"pre-code-title\">Download with Linux commands<\/div><pre class=\"\" data-user=\"root\" data-output=\"\"><code class=\"language-bash\">curl -o composer.phar\u00a0https:\/\/getcomposer.org\/download\/1.6.3\/composer.phar<\/code><\/pre>\n\n\n\n<h2 class=\"is-style-h2df\" id=\"index-list-2\">How to install composers in Windows10<\/h2>\n\n\n\n<p>Run the downloaded exe file. It's easy to follow the installer's instructions.<\/p>\n\n\n\n<p>The work is the same not only in Windows10 but also in earlier versions of Windows.<\/p>\n\n\n\n<h2 class=\"is-style-h2df\" id=\"index-list-3\">How to install composers in CentOS<\/h2>\n\n\n\n<p>The following method of installing composer on CentOS is to download composers.phar and install it yourself.<\/p>\n\n\n\n<p>There are two installation tasks<\/p>\n\n\n\n<div class=\"wp-block-origin-block-em-box em-group em-group-default\">\n<ul><li><strong><span class=\"marker-pink\">Creating the composer command<\/span><\/strong><\/li><li><strong><span class=\"marker-yellow\">Composer command path settings<\/span><\/strong><\/li><\/ul>\n<\/div>\n\n\n\n<h3 class=\"is-style-h3df\" id=\"index-list-4\">Creating the composer command<\/h3>\n\n\n\n<p>Move the downloaded composer.phar to your desired location. Here we create the composer command in '\/home\/myuser\/bin'.<\/p>\n\n\n\n<div class=\"pre-code-title\"><\/div><pre class=\"\" data-user=\"\" data-output=\"\"><code class=\"language-bash\">mv composer.phar ~\/bin\/composer<\/code><\/pre>\n\n\n\n<p>This work is not absolutely necessary. It is not necessary if you use the command name \"composer.phar\".<\/p>\n\n\n\n<p>However, it is common to name the command \"composer\", so you should work with it.<\/p>\n\n\n\n<p>On Linux, the permissions of the downloaded file are \"rw-rw-r--\" (664).<\/p>\n\n\n\n<figure class=\"wp-block-table aligncenter\"><table><thead><tr><th>Login users<\/th><th>Group<\/th><th>Other users<\/th><\/tr><\/thead><tbody><tr><td>rw-<\/td><td>rw-<\/td><td>r--<\/td><\/tr><tr><td>6<\/td><td>6<\/td><td>4<\/td><\/tr><tr><td>Read, Write<br>Impossible to execute<\/td><td>Read, Write<br>Impossible to execute<\/td><td>Read Only<br>Impossible to execute<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>This will not allow anyone to run, so change the permissions with the chmod command.<\/p>\n\n\n\n<div class=\"pre-code-title\">\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u5909\u66f4\u30b3\u30de\u30f3\u30c9<\/div><pre class=\"\" data-user=\"\" data-output=\"\"><code class=\"language-bash\">chmod 764 composer<\/code><\/pre>\n\n\n\n<p>The modified permissions are \"rwx-rw-r--\".<\/p>\n\n\n\n<figure class=\"wp-block-table aligncenter\"><table><thead><tr><th>Login users<\/th><th>Group<\/th><th>Other users<\/th><\/tr><\/thead><tbody><tr><td>rwx<\/td><td>rw-<\/td><td>r--<\/td><\/tr><tr><td>7<\/td><td>6<\/td><td>4<\/td><\/tr><tr><td>Read, Write<br>Executable<\/td><td>Read, Write<br>Impossible to execute<\/td><td>Read Only<br>Impossible to execute<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<div class=\"wp-block-origin-block-a-link-ext alk-ex\"><a href=\"https:\/\/tadtadya.com\/en\/linux-chmod-changing-file-and-directory-permissions-2\/\" title=\"Linux chmod, change file and directory permissions\"><strong>Linux chmod, change file and directory permissions<\/strong> <i class=\"fas fa-angle-double-right\"><\/i><\/a><\/div>\n\n\n\n<div class=\"wp-block-origin-block-em-box em-group em-group-point\">\n<p>Composer command creation, just rename the composer.phar file<\/p>\n<\/div>\n\n\n\n<h3 class=\"is-style-h3df\" id=\"index-list-5\">Composer command path settings<\/h3>\n\n\n\n<p>Set the environment variable $PATH to allow the composer command to be used anywhere.<\/p>\n\n\n\n<p>Edit .bash_profile.<\/p>\n\n\n\n<div class=\"pre-code-title\"><\/div><pre class=\"\"><code class=\"language-vim\">echo 'export PATH=\"$PATH:$HOME\/bin\"' >> .bash_profile<\/code><\/pre>\n\n\n\n<p>Added \":$HOME\/bin\".<\/p>\n\n\n\n<p>Run this command to reflect the settings of $PATH.<\/p>\n\n\n\n<div class=\"pre-code-title\"><\/div><pre class=\"\"><code class=\"language-vim\">source .bash_profile<\/code><\/pre>\n\n\n\n<p>That's all for the installation of the composer command.<\/p>\n\n\n\n<p>RedHat Linux is the same task; on Devian Linux, such as Ubuntu, you should replace the path setting in the Composer command with Devian commands.<\/p>\n\n\n\n<h2 class=\"is-style-h2df\" id=\"index-list-6\">Checking for installation<\/h2>\n\n\n\n<p>Finally, check for successful installation; the same method for both Linux and Windows.<\/p>\n\n\n\n<div class=\"pre-code-title\"><\/div><pre class=\"\" data-user=\"\" data-output=\"\"><code class=\"language-bash\">composer -V<\/code><\/pre>\n\n\n\n<p>Or, if you have multiple versions of php installed, etc., and you want to specify which php commands to use, do this.<\/p>\n\n\n\n<div class=\"pre-code-title\"><\/div><pre class=\"\" data-user=\"\" data-output=\"\"><code class=\"language-bash\">php7 ~\/bin\/composer -V<\/code><\/pre>\n\n\n\n<p>(php command names should fit the environment)<\/p>\n\n\n\n<div class=\"pre-code-title\"><\/div><pre class=\"\" data-user=\"root\" data-output=\"\"><code class=\"language-bash\">Composer version 1.6.3 2018-01-05 15:28:41<\/code><\/pre>\n\n\n\n<p>If you see this result, it has been successfully installed.<\/p>\n\n<!-- WP QUADS Content Ad Plugin v. 2.0.65.1 -->\n<div class=\"quads-location quads-ad2\" id=\"quads-ad2\" style=\"float:none;margin:0px;\">\n<ul class=\"quads-location-ul\">\r\n<li class=\"quads-location-li li-1\">\r\n<script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block\"\r\n     data-ad-client=\"ca-pub-4926008942376207\"\r\n     data-ad-slot=\"6550760310\"\r\n     data-ad-format=\"auto\"\r\n     data-full-width-responsive=\"true\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script>\r\n<\/li>\r\n<li class=\"quads-location-li li-2\">\r\n<script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block\"\r\n     data-ad-client=\"ca-pub-4926008942376207\"\r\n     data-ad-slot=\"6550760310\"\r\n     data-ad-format=\"auto\"\r\n     data-full-width-responsive=\"true\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script>\r\n<\/li>\r\n<\/ul>\n<\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>PHP composer is a command tool to manage packages. It is absolutely necessary in the development of PHP programs. We will show you how to install the composer in a simple way with samples and captures.<\/p>\n","protected":false},"author":1,"featured_media":12485,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"jetpack_publicize_message":"php: How to install composer\r\n\r\n#php\r\n#php_composer\r\n#php_How_to_install_composer","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_options":[]},"categories":[9,43,179],"tags":[265,369,547],"jetpack_publicize_connections":[],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/tadtadya.com\/en\/wp-content\/uploads\/sites\/2\/2018\/10\/php-1.png?fit=1280%2C671&ssl=1","jetpack_sharing_enabled":false,"jetpack_shortlink":"https:\/\/wp.me\/p8Qw77-1AY","jetpack_likes_enabled":false,"_links":{"self":[{"href":"https:\/\/tadtadya.com\/en\/wp-json\/wp\/v2\/posts\/6136"}],"collection":[{"href":"https:\/\/tadtadya.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tadtadya.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tadtadya.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tadtadya.com\/en\/wp-json\/wp\/v2\/comments?post=6136"}],"version-history":[{"count":0,"href":"https:\/\/tadtadya.com\/en\/wp-json\/wp\/v2\/posts\/6136\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tadtadya.com\/en\/wp-json\/wp\/v2\/media\/12485"}],"wp:attachment":[{"href":"https:\/\/tadtadya.com\/en\/wp-json\/wp\/v2\/media?parent=6136"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tadtadya.com\/en\/wp-json\/wp\/v2\/categories?post=6136"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tadtadya.com\/en\/wp-json\/wp\/v2\/tags?post=6136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}