使用 satis 搭建 composer 本地仓库
环境
- windows
- nginx
- php
- composer
安装
拉取 satis 项目包,并拉取项目依赖
```
composer create-project composer/satis --stability=dev
cd satis
composer install
<h2>配置</h2>
<p>修改 satis/config.json 文件,文件内容如下</p>
{
"name": "composer 本地仓库",
"homepage": "http://packages.example.org", // 访问域名
"repositories": [// 要拉取包的仓库地址
{ "type": "vcs", "url": "https://github.com/test-lin/db.git" },
{ "type": "vcs", "url": "https://github.com/test-lin/queue.git" },
{ "type": "vcs", "url": "https://github.com/test-lin/cache.git" },
{ "type": "vcs", "url": "http://192.168.6.251:3000/php/xjwSpider.git" }
],
"require": { // 要拉取到本地的包文件 注:不会包含包的依赖
"test-lin/db": "",
"test-lin/queue": "",
"test-lin/cache": "",
"php/xjwSpider": ""
},
"archive": {
"directory": "dist",
"format": "tar",
"prefix-url": "http://packages.example.org" // * 这个参数是当前项目的域名,作用是以zip压缩包的方式直接下载包文件
}
}
<h2>拉取包到本地仓库</h2>
<p>web/ 是本地仓库访问地址。</p>
php bin/satis build config.json web/
<p>如果需要定时更新,则需要配置定时任务去定时更新</p>
<h2>设置本地仓库</h2>
<p>nginx 设置虚拟主机</p>
server {
listen 80;
server_name packages.example.org;
root /var/www/satis/web;
index index.php index.html;
location ~* \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
}
}
<h2>使用本地仓库中的包</h2>
<p>composer.json 文件中添加以下 json 拉取,即可获取本地库了.</p>
<p>如果本地仓库不存在且有网络会去网络中获取。repositories 参数可以设置多个</p>
{
"repositories": [{
"type": "composer",
"url": "http://packages.example.org"
}]
}
<h2>FQA</h2>
<h3>1. github 的包需要配置 token</h3>
Could not fetch https://api.github.com/repos/test-lin/db/git/refs/heads?per_page=100, please create a GitHub OAuth token to go over the API rate limit
Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+packages.example.org+2018-06-28+0310
to retrieve a token. It will be stored in "/home/vagrant/.config/composer/auth.json" for future use by Composer.
<p>解决方法:</p>
<p>访问命令行中提示的 <a href="https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+packages.example.org+2018-06-28+0310" rel="nofollow noreferrer">https://github.com/settings/t...</a></p>
<p>复制 token description 文本框中内容</p>
<p>拉到页底 点击 generate token</p>
<p>在命令行中粘贴复制内容确认限可</p>
<h3>2. 私有包,拉取不了</h3>
<p>解决方法:</p>
<p>本地生成 ssh key ,配置到要拉取项目的平台即可,免密拉取了</p>
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub
<p>以 gogs 为例</p>

<h3>3. composer 不支持 http</h3>
Your configuration does not allow connections to http://192.168.6.251:3000/php/xjwSpider.git. See https://getcomposer.org/doc/06-config.md#secure-http for details.
<p>解决方法:</p>
composer config -g secure-http false
<h3>4. 拉取的包 composer.json 配置有误</h3>
[Composer\Repository\InvalidRepositoryException]
No valid composer.json was found in any branch or tag of http://192.168.6.251:3000/php/xjwSpider.git, could not load a package from it.
<p>解决方法:</p>
<ol>
<li>确保项目根部有 composer.json</li>
<li>composer.json 里需要设置 name</li>
</ol>
原文地址:https://segmentfault.com/a/1190000016523278
使用 satis 搭建 composer 本地仓库的更多相关文章
- 使用Nexus搭建Maven本地仓库
阅读目录 序 Nexus 本文版权归mephisto和博客园共有,欢迎转载,但须保留此段声明,并给出原文链接,谢谢合作. 文章是哥(mephisto)写的,SourceLink 序 在工作中可能存在有 ...
- nexus 搭建maven本地仓库
使用Nexus搭建Maven本地仓库 阅读目录 序 Nexus 序 在工作中可能存在有些开发机器不能上网,大量的机器获取jar包会导致公司网络很慢,还有时候公司会自己发布自己的项目版本,其他的项目 ...
- Linux 用脚本编写搭建yum本地仓库
Linux 用脚本编写搭建yum本地仓库 源码如下: #!/bin/bash #该脚本用于自动化搭建本地yum仓库 #挂载光盘 #作者:雨中落叶 #博客:https://www.cnblogs.com ...
- 搭建YUM本地仓库
本文介绍如何利用CentOS 7 ISO光盘镜像搭建YUM本地仓库. 环境准备: (1)VMware15.5版本虚拟机 (2)CentOS-7-x86_64-DVD-1908光盘镜像文件 1. 搭建Y ...
- 搭建maven本地仓库,idea应用本地maven仓库
提环境: 安装好tomcat.maven.jdk.idea. 打开maven安装目录,在目录下新建 maven仓库文件夹(名子随便): 打开conf\setting.xml 加入<localRe ...
- Satis搭建composer私有库(自定义下载目录)
在我们的日常php开发中需要使用大量的第三方包和类库, 怎么管理是一个问题, 我们用的Yii2框架, 但是并没有把composer用起来, 由于最近更换为docker部署项目, 于是想起来用compo ...
- satis 搭建 Composer 私有库的方法
安装 satis 命令行下执行: php create-project composer/satis --stability=dev --keep-vcs . 配置 创建 satis.json 文件, ...
- 使用apt-mirror搭建debian本地仓库
apt-mirror能够将官方镜像下载到本地,并保证目录结构与其一致,但是不能对镜像仓库进行修改.如果想要修改镜像仓库,需要使用reprepro. 1.安装apt-mirror # aptitude ...
- 使用Nexus2搭建Maven本地仓库
由于OS为WindowsXP,而Nexus3forWindows为x64版本,只能选择安装nexus2了. Windows(x86)平台,Nexus Repository Manager OSS 2. ...
随机推荐
- 训练1-P
一个矩形的面积为S,已知该矩形的边长都是整数,求所有满足条件的矩形中,周长的最小值. 例如:S = 24,那么有{1 24} {2 12} {3 8} {4 6}这4种矩形,其中{4 6}的周长最小, ...
- BZOJ 3110 [ZJOI2013]K大数查询 (整体二分+线段树)
和dynamic rankings这道题的思想一样 只不过是把树状数组换成线段树区间修改,求第$K$大的而不是第$K$小的 这道题还有负数,需要离散 #include <vector> # ...
- 2015 Multi-University Training Contest 6 hdu 5357 Easy Sequence
Easy Sequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)T ...
- rabbitMQ学习笔记(一)Windows 与Linux下rabbitMQ的安装
版权声明:本文为博主原创文章,未经博主允许不得转载. Normal 0 7.8 磅 0 2 false false false EN-US ZH-CN X-NONE /* Style Definiti ...
- httpservlet这个类是属于Tomcat自带jar包的jjava ee类
bug:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path ...
- spring mvc流程理解
1.controller处理的终究就是一个结果,默认是modelandview对象,controller里自己随便调用service或者dao,终究都还是在controller里有返回值. 2. 在 ...
- T4系列文章之1:认识T4
一.导读 MSDN:Code Generation and T4 Text Templates 博客园:编写T4模板进行代码生成 Oleg Sych系列文章:http://www.olegsych.c ...
- HDU 5167
范围 内的斐波那契的数不多,求出范围内的数,再暴力枚举即可. #include <iostream> #include <cstdio> #include <algori ...
- Unity特殊目录和脚本编译顺序
特殊目录和脚本编译顺序 大多数情况下,您能够选择不论什么你喜欢的目录在您的项目的名称.但unity储备一些名称以指示内容有一个特殊的用途.这些目录中有些会影响脚本编译的顺序.从根本上说,有四个单 ...
- 转换Arcgis Server REST接口实现OL2直接调用
概述: 本文解说怎样通过Arcgis Server REST 的导出地图(Export)接口.实如今OL2中直接以WMS的方式调用Arcgis Server REST服务. 实现思路: 1.rest的 ...