Home / Linux / How to Install Composer on CentOS 8

How to Install Composer on CentOS 8

How to Install Composer on CentOS 8

Composer is the preferred bundle administration program for PHP, that provides a normal type for managing dependencies of PHP purposes and wanted libraries that your challenge depends on and it’ll handle (set up/replace) them for you simply.

Composer is a command-line program that installs dependencies and libraries for purposes which might be obtainable on packagist.org, which is its fundamental repository consist of accessible packages.

Composer is a really useful device for builders when they’re in want and need to handle and incorporate the packages for his or her PHP challenge. It accelerates time and is really helpful to remedy any essential points in a lot of the internet initiatives.

In this tutorial, we’ll present you ways to set up Composer on CentOS 8 Linux.

Requirements

  • A root account or sudo privileged account with shell entry.
  • PHP 5.three.2+ with wanted extensions and settings.

Installing Composer on CentOS 8

To set up Composer, you should set up PHP on the system with required PHP extensions utilizing the next dnf command.

# dnf set up php php-cli php-zip php-json
Install PHP on CentOS 8Install PHP on CentOS 8

Install PHP on CentOS 8

Now set up Composer utilizing an installer which you could execute regionally as a part of your challenge, or globally as a system-wide executable.

Install Composer Locally

To set up Composer regionally on your present listing, execute the next script in your terminal.

# php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
# php -r "if (hash_file('sha384', 'composer-setup.php') === 'c5b9b6d368201a9db6f74e2611495f369991b72d9c8cbd3ffbc63edff210eb73d46ffbfce88669ad33695ef77dc76976')  else  echo 'Installer corrupt'; unlink('composer-setup.php');  echo PHP_EOL;"
# php composer-setup.php
# php -r "unlink('composer-setup.php');"
Install Composer Locally in CentOS 8Install Composer Locally in CentOS 8

Install Composer Locally in CentOS 8

The above installer will examine some php.ini settings and warn you if they’re set wrongly. Then the installer will obtain the newest composer.phar within the present working listing.

The four traces above will, so as:

  • Download the installer to the present listing.
  • Verify the installer signature (SHA-384).
  • Run the installer.
  • Remove the installer.

Finally, run php composer.phar so as to run Composer.

# php composer.phar
Run PHP Composer in CentOS 8Run PHP Composer in CentOS 8

Run PHP Composer in CentOS 8

Install Composer Globally

To set up and entry Composer globally system-wide, you want to place Composer PHAR in your system PATH, so that you could execute it with out utilizing the PHP interpreter.

To set up Composer globally for all customers, run the installer utilizing the next instructions.

# php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
# php -r "if (hash_file('sha384', 'composer-setup.php') === 'c5b9b6d368201a9db6f74e2611495f369991b72d9c8cbd3ffbc63edff210eb73d46ffbfce88669ad33695ef77dc76976')  else  echo 'Installer corrupt'; unlink('composer-setup.php');  echo PHP_EOL;"
# php composer-setup.php
# php -r "unlink('composer-setup.php');"
# mv composer.phar /usr/native/bin/composer
# chmod +x /usr/native/bin/composer
# composer -V
Install Composer Globally in CentOS 8Install Composer Globally in CentOS 8

Install Composer Globally in CentOS 8

Now that you simply’ve put in Composer efficiently on your CentOS 8 system. To study extra in regards to the PHP Composer and how will you put it to use in your initiatives go to the official documentation.

About Agent

Check Also

SpaceX Successfully Launches 60 More Starlink Satellites as it Continues Towards 2020 Service Debut

SpaceX Successfully Launches 60 More Starlink Satellites as it Continues Towards 2020 Service Debut SpaceX …

Leave a Reply

Your email address will not be published. Required fields are marked *