新建项目
拉取项目
初始化项目
输入包名后,一直回车即可。
1 2 3 4 5 6 7 8 9 10 11 12
| { "name": "hdk/common", "description": "", "authors": [ { "name": "ydg", "email": "1028180290@qq.com" } ], "require": {} }
|
代码开发
composer.json 修改
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| { "name": "hdk/common", "description": "hdk code", "authors": [ { "name": "ydg", "email": "1028180290@qq.com" } ], "require": { "php": ">=7.1", "guzzlehttp/guzzle": "^6.2 || ^7.0", "pimple/pimple": "^3.0", "ext-json": "*", "ext-openssl": "*", "ext-mbstring": "*", "ext-ctype": "*" }, "autoload": { "psr-4": { "Hdk\\Common\\": "Common/src/", "Hdk\\Sdk\\": "Sdk/src/" } }, "minimum-stability": "dev", "prefer-stable": true, "config": { "optimize-autoloader": true, "sort-packages": true } }
|
提交代码并推送分支
新建标签
在其他项目中引入该 composer 包
修改项目中的 composer.json
“repositories”: {
“haodanku-common”: {
“type”: “git”,
“url”: “http://gitlab.xxx.com/yandonggan/haodanku_common.git"
}
},
“config”: {
“secure-http”: false
}
}
1 2 3
| ```bash composer require 包名
|