Php composer's learning path and phpcomposer's path

Source: Internet
Author: User

Php composer's learning path and phpcomposer's path

The introduction of composer please see here http://docs.phpcomposer.com/00-intro.html

I will not introduce the installation process of composer. There is no difference between the installation process and other installation processes in windows. Just keep on going to the next step.

After installation, check whether the installation is successful.

Run cmd, open the command window, and enter composer-v. the following content indicates that the installation is successful:

Otherwise, an error message is displayed.

Then we need to configure it as a domestic image and enter this command:composer config -g repo.packagist composer https://packagist.phpcomposer.com

Just copy it in.

After that, let's take a look at how to import the database file:

First, create a composer. json file in the root directory of the project;

Let us know the library name and version number we introduced, first go to this website to search to view https://packagist.org/

For example, if we want to install smarty, we will search for smarty.

When it comes out, we click the first one to view the details. Because the website is abroad, it will be slow. Please wait;

Here are some usage methods for translation. I will not introduce them;

After you know the Database Name and version number, open the file you just created and enter the code:

{  "require": {    "smarty/smarty": "3.1.21"  }}

 

After that, open the command window, go to the root directory of our project, and then enter composer install

A class library is successfully installed;

You will find that there will be an additional folder in your project, and there will be a folder named smarty.

 

To add more class libraries, you need to add the library name and version number in composer. json as follows:

{  "require": {    "smarty/smarty": "3.1.21",    "monolog/monolog":"1.23.0"  }}

Enter composer update in the Command window.

To delete a class library, enter composer remove smarty/smarty in the naming window.

This will delete the smarty class library.

Come here first. Thank you for watching. If you have any questions or suggestions, please leave a message for us to study together !!

 

 

 

 

 

 

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.