Inspired by
npm (https://www.npmjs.com/) and
bundler (http://bundler.io/), Composer (https://getcomposer.org/) manages the dependencies of your project and installs packages in predetermined directories (for example, vendor) using the composer.json file in the Magento module or theme. This kind of management is very useful once each library has your specific dependency. Composer doesn't let you waste your time by connecting the dependencies to every deployment that you want to do.

In the next chapters, we will use Composer to install components on Magento. However, first, we will start the development of our theme; it is necessary to declare our composer.json file. For now, let's install Composer on the operating system.
To install Composer on Unix-like systems (such as Unix, Linux, and OS X), you simply need to run these two commands in the terminal:
$ curl -s https://getcomposer.org/installer | php $ sudo mv composer.phar /usr/local/bin/composer
The first command downloads the composer.phar installation file. The second command moves the file to the bin directory to install Composer globally on your computer.
Run the following command to check whether Composer was successfully installed:
$ composer
The $ composer command lists all the available Composer commands and their descriptions:

To install Composer on Windows, you simply have to download and execute Composer-Setup.exe, which is available on https://getcomposer.org/Composer-Setup.exe.
This executable file will install the latest Composer version and set up your path to use the composer command in the command prompt window. Open the command prompt window and run command composer to get the list of available commands of Composer.