Satis 原理:通过配置文件生成相关库的元数据提供给composer,先通过git 下载 satis 代码库,创建一个 json 配置文件如下示例
{
"name": "longxiangam/repository", // Satis 生成的仓库的“名称”,显示在 packages.json 中,通常是“我的私有仓库”这种描述性名字
"homepage": "http://composer.test", // Satis 生成的静态仓库首页 URL(浏览器访问这个地址能看到 packages.json 和搜索界面)
"repositories": [ // 指定要扫描/镜像的源仓库(可以是 git、vcs、path 等类型)
{
"type": "git",
"url": "https://github.com/longxiangam/dingtalk.git"
}
],
"require-all": false, // 关键字段:false → 不镜像“repositories”里所有包的所有版本
// 如果 true → 会镜像 repositories 里所有包的所有 commit/branch/tag 版本(非常多,适合全镜像场景)
"require": { // 关键字段:显式指定要镜像哪些包(Composer 的 require 语法)
"mingyoung/dingtalk": "*" // 只镜像这个包的所有版本(* 表示任意版本,包括所有 tag/branch)
},
"require-dependencies": false, // 是否自动镜像“require”里包的依赖(dependencies)
// false → 不镜像依赖,只镜像 mingyoung/dingtalk 本身
// true → 会递归镜像它的依赖(如它依赖 guzzlehttp/guzzle,则也会镜像 guzzle)
"require-dev-dependencies": false // 是否镜像 dev-dependencies(require-dev 里的包,如测试工具 phpunit)
// 通常设为 false,除非你想在私有仓库里也提供测试依赖
}
再通过命令构建出用于web发布的静态文件,命令如下, 最后两个指定配置与输出目录,构建出dist 后用nginx 发布成一个服务能够访问即可
php bin/satis build satis.json dist
在composer.json 中配置私有库
{
"repositories": [
{
"type": "composer",
"url": "http://composer.test"
}
]
}
提示 如下时
Your configuration does not allow connections to http://composer.test/packages.json. See https://getcomposer.org/doc/ 06-config.md#secure-http for details.
配置 secure-http 为false
composer config secure-http false
如果在 docker 中使用composer 要注意 配置的私有库是否能正常访问
用户今天 : 9
用户昨天 : 17
用户最近的7天 : 144
用户最近的30天 : 556
用户这个月 : 437
用户这一年 : 4989
合计用户 : 11658
查看今天 : 151
查看昨天 : 20
查看最近7天 : 301
查看最近30天的 : 775
查看这个月 : 639
查看这一年 : 6238
合计查看 : 14402
谁是在线的 : 0