Home  >  Article  >  Development Tools  >  How to use composer command to load third-party class library in vendor

How to use composer command to load third-party class library in vendor

藏色散人
藏色散人forward
2019-10-17 16:17:543376browse

Below, the composer usage tutorial column will introduce to you how to use the composer command to load the third-party class library in the vendor. I hope it will be helpful to friends in need!

How to use composer command to load third-party class library in vendor

1. First download the required third-party class library and place it in the vendor folder under the TP framework.

2. Provide the third-party class library SDK Write the namespace. The namespace is the name corresponding to the folder of the class library

How to use composer command to load third-party class library in vendor

3. Add the third-party class library that needs to be loaded in the composer.json file

4. Open cmd, enter the project root directory, use the composer command to load the third-party class library, and execute composer dump-autoload as follows. If successful,

How to use composer command to load third-party class library in vendor

5. Use

to directly use use to reference the required third-party class library where it is used.

You must use "sina\\": "vendor/sina" in Article 3 (sina is the namespace, vendor/sina is the corresponding file location), and the command in Article 4 can be used use to introduce, otherwise you can only use the vendor() method to introduce

The above is the detailed content of How to use composer command to load third-party class library in vendor. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:jb51.net. If there is any infringement, please contact admin@php.cn delete