In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article is about how to use composer to pull libraries. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.
1. There are two ways to pull the library using composer. The first one is pulled from the command line.
For example, when we need to integrate monolog, we just need to know that composer defaults the library to the vendor folder under the current folder.
Therefore, we can navigate to the root directory of the framework through the command line, whether windows or linux. The following command takes windows as an example. Assuming that our framework is installed in the environment directory of phpstudy, and the path is D:\ phpstudy\ www, we can run cmd input as an administrator:
Cd / d D:\ phpstudy\ www
Then we can pull it from the command line.
Composer require monolog/monolog
After waiting for a while, composer will automatically obtain the monolog-related files locally. If you think it is too slow, we can execute the command on the command line and switch to the domestic line:
Composer config-g repo.packagist composer https://packagist.phpcomposer.com
two。 Next, let's talk about the second way, the second way is similar to the first one, and the extra one is the json file.
We will find a composer.json file in the root directory of the frame. We can open it with an editor. We can find the php key without looking at other information. By default, there is a "php": "> = 5.4.0", which means that the version of php used must be greater than 5.4.0.
We can use "library name": "version number method" to define the list of libraries we need, and the specific version constraints. Click here to learn about it.
Let's take monolog as an example. We can do this by appending require. The final require is:
"require": {"php": "> = 5.4.0", "monolog/monolog": "1.2.*"}
Then save the json file, enter cmd, locate the directory to the same level as the json file, and enter:
Composer update
And then enter the stage of updating the package.
When it appears
Thank you for reading! On how to use composer pull library to share here, I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.