What is composer? How to install composer in windows?

In this article we are going know about Composer and how to use composer. I am writing this because we will need composer for installing dependency packages for Codeception.

What is Composer? 
Composer is a PHP dependency manager. You may find similar to Maven for java. The main difference is , Maven use XML where Composer use JSON file to write dependencies. And, in Maven we can manage the package but composer deals with framework/libraries.

Composer finds out specific version of a package needs to be installed and install it with its dependent packages.

Requirements : 
Composer needs minimum PHP 5.3.2.
PC should have cUrl with PHP installed(not only for composer, other tools also)

How to install ?
Step 1 : There are several ways to download, but as I use Windows, I download this and install in windows. 
Step 2 : Set installed folder location (C:\ProgramData\ComposerSetup\bin) in system's path variable.( get help from this post) 

How to Declare Dependencies? 
Declaring composer is very simple. In the project root, create a file composer.json . Edit that json file with text editor start like this .
"require" : {


Then we add our dependency packages along with version number in the require braces. Ex: for installing codeception, we have to write like this
    "require": {
        "codeception/codeception": "*"

To write package, we have to follow JSON way. Like "Vendor Name/Package Name" : "Version Number".  In version number ,
* = any version,
1.3.*=  any version start with 1.3.

And , to install that dependencies, we need write this in command line
cd <project folder where composer.json is present>
composer update

Note : Here we have manually added composer.json. If we use composer init in command prompt, we will get a wizard in command line to create composer.json file with specific package. 
We can use Auto loading(before launching application)  with composer

When we use? 
1. When we have a project which is dependent on a number of Libraries
2. Some of those libraries are dependent on other libraries.
3. We might have our own custom dependent libraries

To get more detail, you may read this PDF.