Home >Development Tools >composer >How does composer require load local extension packages?
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
Create the packages directory and create an extension package
mkdir packages && cd packages
Create an extension package
mkdir -p hail812/hello && cd hail812/hello composer init # 一路回车
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
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!