Home > Development Tools > composer > How does composer require load local extension packages?

How does composer require load local extension packages?

藏色散人
Release: 2021-02-25 15:43:39
forward
4816 people have browsed it

The tutorial column of composer below will introduce composer require to load the local expansion package. I hope it will be helpful to friends in need!

Create the directory composerLocal, composer init (Enter all the way)

mkdir composerLocal && cd composerLocal
composer init
Copy after login

Create the packages directory and create an extension package

mkdir packages && cd packages
Copy after login

Create an extension package

mkdir -p hail812/hello && cd hail812/hello
composer init # 一路回车
Copy after login

Extension In the composer.json file of the package, the name is consistent with the directory name

Configure composer.json

Configure the autoload of composer.json of the extension package
Configure the project root Repositories of composer.json in the directory

Directory structure

##Extension package composer.json

Composer.json in the root directory

##Execute composer require

composer require hail812/hello:dev-master
Copy after login

project The vendor directory

will be added for testing, and a new index.php file will be created

The above is the detailed content of How does composer require load local extension packages?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template