First of all, I had already installed and configured zend framework 2 in include_path
of php.ini. But when I was installed zend framework skeleton application using composer install
then it do some process and then again download whole zend framework 2 in to 'vendor' directory (which is automatically created in my application directory). Please help me that why composer again download and install whole framework and why it do not use already installed copy?
The short answer is that composer is designed to install dependencies on a per application level rather than globally. So all dependencies specified in the composer.json file will be pulled in to your project's vendor folder. This will happen even if you happen to have a certain dependency installed globally on your system.
Composer does not look at your environment - it looks at the dependancies that have been specified by the packages.
However, you can control how these dependancies are satisfied.
As a result you will need a method to demonstrate to composer that the dependancies are being met.
For example - if you install Zend using PEAR - you can tell Composer to look for the pear package rather than downloading it.
e.g.
{
"repositories": [
{
"type": "pear",
"url": "http://pear2.php.net"
}
],
"require": {
"zend/zend": "*",
}
}