Satis 是一个静态的 composer 代码库生成器。
cd /www/
composer create-project composer/satis --stability=dev --keep-vcs
mv satis packages.your.com
cd packages.your.com
satis的配置是通过satis.json进行的,我们在当前目录新建一个satis.json。
{
"name": "Test Repository",
"homepage": "packages.your.com",
"repositories": [
{"type": "vcs", "url": "http://gitlab.your.com/test/package1.git"},
{"type": "vcs", "url": "http://gitlab.your.com/test/package2.git"},
],
"require": {
"test/package1": "*",
"test/package1": "*",
}
}
php satis/bin/satis build
我们生成的时候一般会生成html和paceages.json文件
php satis/bin/satis build satis.json public/
server {
listen 80;
server_name packages.your.com;
root /www/packages.your.com/public;
}
http://satis.xxxx.cn/
(记得域名指向nginx的ip哟)
假设我们前面 repositories 中 http://gitlab.your.com/test/package1.git test/package1 的composer.json 如下:
{
"name": "test/package1",
"description": "测试",
"type": "library",
"license": "MIT",
"authors": [
{
"name": "wangyu",
"email": "123445678@qq.com"
}
],
"minimum-stability": "dev",
"require": {
"php": ">=7.0"
},
"autoload": {
"psr-4": {
"Test\\": "src/"
}
}
}
我们新的工程需要安装这个包,只需在新工程的composer.json中修改下:
"repositories": [
{ "type": "composer", "url": "http://satis.xxxx.cn/" }
],
"require": {
"test/package1": "*"
}
"config": {
"secure-http": false
}
composer install下,会发下我们的私有包出现在新工程了