Installing Composer Globally- Drupal 8

Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.

Following are the installation shell commands for installing Composer globally-

1. php -r "copy('', 'composer-setup.php');"
2. php -r "if (hash_file('sha384', 'composer-setup.php') === '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
3. php composer-setup.php
4. php -r "unlink('composer-setup.php');"

After running the installer, you can execute following commands to move composer.phar to a directory that is in your path.

1. $ sudo mv composer.phar /usr/local/bin/composer
2. Run composer- $ composer

In case above does not work then try- $ php composer

/usr/local/bin/ should be in your system PATH or move the composer.phar to a directory which is in your system PATH.

Both comments and pings are currently closed.

Comments are closed.