introduction of composer
Composer is a dependency management tool for PHP. It allows you to affirm the code base on which the project depends, and it will install them for you in your project. Composer is not a package manager. Yes, it involves "packages" and "libraries", but it is managed on a per-project basis and installed in a directory of your project (for example, vendor). By default, it does not install anything on the global. So, this is just a dependency management.
Composer will solve this problem for you:
A You have a project that relies on a number of libraries.
b Some of the libraries are dependent on other libraries.
c You declare what you depend on.
D Composer will find out which version of the package needs to be installed and install them (download them to your project).
Second, install composer under Windows
Installation Tutorial: https://getcomposer.org/download/
The first time you follow the first way in the tutorial to install the installation package, but you will encounter a variety of fucked up error
After Baidu Google after the choice of the third manual installation method
Manual Installation steps:
1, download Composer.phar, placed in the same folder Php.exe, download address: https://getcomposer.org/download/(pull down manual download, select the latest version of the download)
2, in the same directory under the new Composer.bat, write
@ECHO off
php "%~dp0composer.phar"%*
Save, close
The following figure
3. Add the environment variable path: D:\xampp\php
4, cmd under the input composer-v
If you can see the following figure, the installation is successful (those warning tips can be used without him)
Iii. use of composer
Use composer to download the RABBITMQ PHP interface to the Local:
1, in the project root directory new Composer.json, write
{
"require": {"php-amqplib/php-amqplib":
"2.6.*"
}
}
2, cmd down the CD to the project root directory, execute the following statement:
PHP D:\xampp\php\composer.phar Install
See the image below shows that the download was successful
At this point you will see the downloaded third party library in the vendor directory of the project
Reference:
Http://docs.phpcomposer.com/00-intro.html
https://getcomposer.org/download/