In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the knowledge of "how to use the create-project command in composer". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Do what?
When will the composer create-project command be used? generally speaking, composer require is used to introduce the library, and create-project is rarely used to install the project. I remember the last time I used this command to write a project with thinkphp5.1. So what is the use of this sentence? here is a quote from Composer's official website.
You can use Composer to create a new project from an existing package. This is equivalent to installing the package's dependencies to its own vendor directory after executing a git clone or svn checkout command.
We can read this information from above, and it does two operations:
Create a new project from an existing package
Install the dependency on vendor in this package
That is, a new project will be created and the dependencies in the project will be downloaded to the vendor directory. So where did this bag come from? Composer said he would look up the package you specified on packagist.org.
How to use it
Know what to do and how to use it. The regular use is like this composer create-project topthink/think think 5.1. Explain this command in detail, which is divided into four parts.
The first part is composer create-project, which tells composer that we are going to create a project
The second part topthink/think is the package name, which can be found on the packagist.org website. If the project cannot be found or created, composer will report an error.
The third part think, this is to give the created project a name, in fact, that is, a directory name, if the directory is there, the directory must be empty, otherwise the creation of the project will fail, if the directory does not exist, it will be created automatically, the directory will be named in English, and some indescribable problems will be encountered in Chinese
The fourth part, the version of the project created, because the project we created comes from the package in the packagist library, and there are different versions of the package. Take the topthink\ think I created as an example, there are 5.1.* and 5.0.versions. If we do not specify the version number, we will use the new version by default. Of course, we can also use the specified version 5.1.38. You can also use the wildcard 5.1.evaluate, the assignment operator ~ 5.1, and so on.
Parameters.
The composer create-project command has some parameters, such as-- prefer-dist when available packages install projects from dist,-- prefer-source when available projects are installed from source
Not only the parameters I mentioned above, but also some parameters, but they have not been used in my work, and I have not studied them carefully. Even if I read them, I also forgot them at that time, so my first step is to learn the command composer create-project, and then to understand how to use its parameters.
This is the end of "how to use the create-project command in composer". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.