Step 1: Go to php.exe located folder. if you are using
if you are using XAMPP it should be in Xamp/php folder
then type cmd on folder path location and hit enter. cmd prompt will open at that directory .
Step 2: Copy and paste this code in CMD.
php -r "readfile('https://getcomposer.org/installer');" | php
If everything's fine, it will show messages like,
"
"
#!/usr/bin/env php All settings correct for using Composer Downloading... Composer successfully installed to: C:\wamp\bin\php\php5.5.12\composer.phar Use it: php composer.phar"
you can see composer.phar file in same folder.
Step 3: Go to any drive of your choice (in my case i choose A drive ) and create a folder named composer. we need to have bellow 3 files in this folder
(i) Move downloaded composer.phar to that folder
(ii) Create composer.bat file in same folder and copy below contents to that file.
(iii) create
and drag that file to your text editor, preferably notepad++ . and paste the below contents and save.
@ECHO OFF php "%~dp0composer.phar" %*
(iii) create
composer
file. without any extensions, you can do this by opening CMD in this folder and typing type NUL > composer
without Quotes.and drag that file to your text editor, preferably notepad++ . and paste the below contents and save.
#!/bin/sh dir=$(d=$(dirname "$0"); cd "$d" && pwd) # see if we are running in cygwin by checking for cygpath program if command -v 'cygpath' >/dev/null 2>&1; then # cygwin paths start with /cygdrive/ which will break windows PHP, # so we need to translate the dir path to windows format. However # we could be using cygwin PHP which does not require this, so we # test if the path to PHP starts with /cygdrive/ rather than /usr/bin. if [[ $(which php) == /cygdrive/* ]]; then dir=$(cygpath -m $dir); fi fi dir=$(echo $dir | sed 's/ /\ /g') php "${dir}/composer.phar" $*
Step 4 : Now, set PATH to composer so we can access composer by just typing composer in CMD.
type environment variable in windows search, you will get suggestions like edit environment variables to click on that.
(i) Select PATH in the user variables list
(ii) Append your PHP Path A:\composer (path to the folder which we created in step 3)to your PATH variable, separated from the already existing string by a semi colon. and click OK
(iii) then just restart your system or open command promt and copy paste bellow command
taskkill /f /IM explorer.exe start explorer.exe exit
And you are done.
Happy Coding :)
0 Comments