Today I saw a dependency management tool that introduced PHP, so we learned to try it out:
Environment: Win7
First, installation
1. Verify that PHP is enabled with the OpenSSL module (using HTTPS URLs);
Modify environment variable path, join c:\xampp\php
Open the command line and enter:
Php-version
Show:
Use the CD command to change the current path to the project root, and then run the command to download the installation:
Php-r "ReadFile (' Http://getcomposer.org/installer ');" | Php
I'm using the HTTP protocol URL here. If you have curl, you can also use the following command:
Curl-ss Https://getcomposer.org/installer | Php
Official website tips can also download the installation package Composer-setup.exe, unfortunately I see late, no trial.
To the project root, add the Composer.bat text file and execute it at the command line:
echo @php "%~dp0composer.phar"%*>composer.bat
Close and reopen the command line and enter the command:
Composer-v
You can see the version information for the output.
example, the project needs to use the output log library Monolog.
Create a Composer.json file within the project and enter the content:
{" require": { "Monolog/monolog": "1.0.*" }}
Execute at cmd command line:
Composer Install
The required URLs may not be downloaded properly for some reason. It may be prompted by the following:
Failed to enable cryptofailed to open stream:operation Failed
You should consider solving your network problems at this time.
After successful operation, the Vendor folder appears in the project folder.
Examples of Use:
Pushhandler (New Monolog\handler\streamhandler (' App.log ', monolog\logger::warning)); $log->addwarning (' Foo ');? >
Third, other
Update itself:
Composer Self-update
The above describes the use of PHP dependency management tool composer, including aspects of the content, I hope that the PHP tutorial interested in a friend helpful.