In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 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 configure composer.json. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
The value of the configuration file is key:val must be wrapped in double quotation marks
I. configuration file
First name name
The package name consists of a user name and a warehouse name
Package version limit to request Monolog package 1.0.*. This means that any version in the 1.0 development branch is greater than or equal to 1.0 and less than 1.1 (> = 1.0 = 1.0, test (); $shipMgr = new Silk\ lib\ ShipManager (); $shipMgr- > test ()
It runs successfully, which shows that it is more convenient to use psr-0 specification to load automatically than classmap.
Can be assigned directly to the class level. This is useful for libraries with only one class in the global namespace
The php source file is also located in the root directory of the package, and can be declared as follows:
{"autoload": {"psr-0": {"UniqueGlobalClass": ""}
If you want to have an alternate directory where namespaces can be used, you can use an empty prefix, such as:
{"autoload": {"psr-0": {":" src/ "}
Under the psr-4 keyword, you can define the namespace to path mapping relative to the package root
Try psr-4, sort out the directory structure, and change it to: apply the root directory\ lib\ OrderManager.php, and modify the class file namespace to Silk [package root folder name /
Folder name in the bag]
Modify autoload
"autoload": {"psr-4": {"Silk\\": "lib", / / Silk represents the command space in the project class file Bind the Silk namespace to / user name / warehouse name / lib directory / / folder path: vedor/ user name / warehouse name / composer.json lib/ Classname.php lib the class file under this folder-> the class name should be the same as the class file. The namespace of the class file is Silk "Monolog\\": "src/",}} / / the vendor/autoload.php is introduced first.
Use namespaces:
Use\ Silk\ class name-> equivalent to using the lib\ class file in the package-> class name
Run composer dump-autoload again
If you need to search for the same prefix in multiple directories, you can specify them as an array:
"autoload": {"psr-4": {"Monolog\\": ["src/", "lib/"]}}
If you want to have an alternate directory that can be found in any namespace, you can use an empty prefix, such as:
"autoload": {"psr-4": {"exclude"}} Thank you for reading! this is the end of this article on "how to configure composer.json". 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 for more people to see!
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.