Saturday, April 30, 2016

Install Composer in XAMPP 1.8.1 and Windows 10 (x64)

Prerequisites:
  • Windows 10 
  • XAMPP work
Make sure openssl extension is enable in php.ini:
extension=php_openssl.dll

Follow this step to install composer
  1. Open cmd Windows
  2. Donwload installer by running this command
    php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php
    for example*
    D:\xampp\php>php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php
  3. Validate your composer-setup.php by running 
    php -r "if (hash_file('SHA384', 'composer-setup.php') === 'a52be7b8724e47499b039d53415953cc3d5b459b9d9c0308301f867921c19efc623b81dfef8fc2be194a5cf56945d223') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
    for example*:
    D:\xampp\php>php -r "if (hash_file('SHA384', 'composer-setup.php') === 'a52be7b8724e47499b039d53415953cc3d5b459b9d9c0308301f867921c19efc623b81dfef8fc2be194a5cf56945d223') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
    Installer verified
  4. Install your composer by running
    php composer-setup.php
    for example*:
    D:\xampp\php>php composer-setup.php
    Some settings on your machine may cause stability issues with Composer.
    If you encounter issues, try to change the following:
    The OpenSSL library (0.9.8x) used by PHP does not support TLSv1.2 or TLSv1.1.
    If possible you should upgrade OpenSSL to version 1.0.1 or above.
    Downloading 1.0.3...
    Composer successfully installed to: D:\xampp\php\composer.phar
    Use it: php composer.phar
  5. Remove composer-setup.php** by running:
    php -r "unlink('composer-setup.php');"
    for example*:
    D:\xampp\php>php -r "unlink('composer-setup.php');"
Note:
* in my case I use stand alone xampp in directory d:
** you do not have to save any composer-setup.php, it may change for a new version
 
References:

  • http://i.justrealized.com/2013/install-composer-windows/
  • https://getcomposer.org/download/

No comments:

Post a Comment