Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the commonly used commands in composer

2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces what are the commonly used commands in composer, which can be used for reference by interested friends. I hope you will gain a lot after reading this article.

Composer common commands

On the Internet to see a common composer command summary, feel very good, the following composer command to use the tutorial column to share with you, I hope to help friends in need!

1. Search package

Composer search

Example:

Composer search qiniu

Search for a package that contains qiniu.

2. Installation of the package

Composer requirecomposer install

Example:

Composer require qiniu/qiniu:dev-master

After installation, two files and a folder are generated, as follows:

Composer.json is the dependent file of the package

Composer.lock is the version lock file of the package

Vendor is the directory where the package is located

For require and install are different, require will add the package information to the composer.json file and install. Install, on the other hand, extracts dependency information directly from composer.json or composer.lock files, and then installs it.

3. Update the package

Go to the URL to find a package https://packagist.org/

First install a package with the following command:

Composer require qsnh/think-auth-v 0.2.0

View the json file:

Cat composer.json

The contents are as follows:

{"require": {"qiniu/qiniu": "dev-master", "qsnh/think-auth": "0.2.0"}}

It is also the 0.2.0 version. Then modify the json file to update 0.2.0 to 0.2.2, and then save.

The package can be updated by executing the following command.

Composer update

I have installed a command line tool called Cmder, where you can use the cat command.

4. Delete the package

The command to delete the package you just added is:

Composer remove qsnh/think-auth

So the package is deleted, take a look at the composer.json file, as follows:

{"require": {"qiniu/qiniu": "dev-master"}}

In this way, the bag is deleted.

5. Rely on packaging

If more than one package is installed in the project, many project dependent packages may be installed, and the package dependencies in the project need to be packaged into a compressed file.

Composer archive

6. Generate the class library mapping file

Composer dump-autoload thank you for reading this article carefully. I hope the article "what are the commonly used orders in composer" shared by the editor will be helpful to you? at the same time, I also hope that you will support us and follow the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report