How to install & start using Composer

  • avatar
  • 1.1K Views
  • 2 mins read

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.

Prerequisites

Composer requires PHP 5.3.2+ to run. A few sensitive PHP settings and compile flags are also required, but when using the installer you will be warned about any incompatibilities.

Installation

Composer offers a convenient installer that you can execute directly from the command line in Linux.

  1. Download Composer from the official website using the following command:

    php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
  2. Install Composer globally as a system wide executable:

    php composer-setup.php --install-dir=/usr/local/bin --filename=composer --version=1.10.20

    We've forced the version 1.10.20 to be installed, you can skip this parameter to install the latest version.

  3. Once it’s done, remove the installer:

    php -r "unlink('composer-setup.php');"

Using composer

In order to check the installation and start using the manager all you need to do is type composer in your terminal. You will see an image as below and a list of available composer commands:

composer.png

 Join Our Monthly Newsletter

Get the latest news and popular articles to your inbox every month

We never send SPAM nor unsolicited emails

0 Comments

Leave a Reply

Your email address will not be published.

Replying to the message: View original

Hey visitor! Unlock access to featured articles, remove ads and much more - it's free.