First knowledge of composer

Source: Internet
Author: User

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/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.