使用statis
登录252服务器
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 33 34 35 36 37 38 39 40 |
cd /data/git/satis vim satis.json { "name": "Jz's Repository", "homepage": "http://packages.9z.cn", "repositories": [ {"type": "vcs", "url": "https://github.com/composer/composer"}, {"type": "vcs", "url": "https://github.com/php-fig/log"}, {"type": "vcs", "url": "https://github.com/symfony/debug"}, {"type": "vcs", "url": "https://github.com/symfony/polyfill-mbstring"}, {"type": "vcs", "url": "https://github.com/symfony/console"}, {"type": "vcs", "url": "git@test:repos/j.git"}, {"type": "vcs", "url": "git@test:repos/j-core.git"}, {"type": "vcs", "url": "git@test:repos/j-console.git"}, {"type": "vcs", "url": "git@test:repos/j-db.git"}, {"type": "vcs", "url": "git@test:repos/j-tree.git"}, {"type": "vcs", "url": "git@test:repos/j-region.git"}, {"type": "vcs", "url": "git@test:repos/j-spider.git"}, {"type": "vcs", "url": "git@test:repos/j-wxsdk.git"}, {"type": "vcs", "url": "git@test:repos/j-segmentation.git"}, {"type": "vcs", "url": "git@test:repos/j-log.git"}, {"type": "vcs", "url": "git@test:repos/j-payment.git"}, {"type": "vcs", "url": "git@test:repos/j-project.git"}, {"type": "vcs", "url": "git@test:repos/ide-doc.git"}, {"type": "vcs", "url": "git@test:repos/j-tcp.git"}, {"type": "vcs", "url": "git@test:repos/j-http.git"}, {"type": "vcs", "url": "git@test:repos/j-http1.git"}, {"type": "vcs", "url": "git@test:repos/syar.git"}, {"type": "vcs", "url": "git@test:repos/j-api.git"} ], "require-all": true, "archive": { "directory": "dist", "format": "tar" } } |
可以下载一些常用的开源包缓存到公司
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
{ "type": "package", "package" : { "name": "composer/composer", "version": "1.2.3", "dist": { "url": "https://github.com/composer/composer/archive/1.2.3.zip", "type" : "zip" } } }, { "type": "package", "package" : { "name": "psr/log", "version": "1.0.2", "dist": { "url": "https://github.com/php-fig/log/archive/1.0.2.zip", "type" : "zip" } } }, |
生成静态资源包
1 |
php bin/satis build satis.json www/ [packname] |
生成过程中如果需要输入Token, 访问提示的地址, 在github生产新token即可
配置nginx
1 2 3 4 5 6 7 |
server { listen 80; server_name packages.9z.cn; root /data/git/satis/www; index index.html; charset utf-8; } |
使用私有包
将安全连接关闭
1 |
composer config -g secure-http false |
配置项目composer源
1 2 3 4 5 6 7 8 9 10 11 |
"repositories": [ { "type": "composer", "url": "http://packages.9z.cn" }, { "type": "composer", "url": "https://packagist.phpcomposer.com" }, {"packagist": false} ], |
可一并配置git项目用户访问权限
安装包
1 |
composer require LIB_NAME |
安装项目
1 2 3 |
cd your_path composer create-project --repository-url http://packages.9z.cn/ stcer/j-project YOUR_PROJECT_DIR dev-master composer create-project --no-dev --repository-url http://packages.9z.cn/ stcer/j-project project3 dev-master |