前面已经说了如何使用composer,以及配合使用 packagist 搭建代码库;
本章要讲的是 用自己的服务器使用 satis 搭建私人的代码库


1、 Satis 是一个静态的 composer 代码库生成器

$ composer.phar create-project composer/satis --stability=dev

2、在当前目录下会有一个文件夹 satis

$ cd satic
$ vim satis.json

我的 satis.json 文件配置

{"name": "Nothing","homepage": "http://packagist.xxx.top","repositories": [{ "type": "vcs", "url": "https://gitee.com/liulonghai/test.git","type": "vcs", "url": "https://gitee.com/liulonghai/Helper.git"}],"require": {"xiaoliu/test": "*","nothing/helper": "*"}
}

简单说一下
name : 是名称 可以随便取
homepage : 是在satis上显示的默认私有镜像地址
repositories:需要被索引的git代码仓库地址,而我用的是码云,所以把地址复制下来即可
require:就是你要导入的包名 以及版本  我这里是 * 表示所以发布的包我都加入

3、使用 satis.json 配置来构建我们的代码库 输出到web目录下

$ php bin/satis build satis.json web[web是我们输出的目录] 后面加上 -v 参数可以看到被索引的包

error:
01:  PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 88 bytes) in /data/wwwroot/satis/vendor/composer/composer/src/Composer/Repository/ComposerRepository.php on line 566Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 88 bytes) in /data/wwwroot/satis/vendor/composer/composer/src/Composer/Repository/ComposerRepository.php on line 56602、把php.ini     memory_limit 修改成512M 即可03、如果不知道php.ini在哪里 可以使用 php --ini04、其他错误则根据错误提示去解决

4、配置一下nginx

  server {listen 80;server_name packagist.xxx.top;access_log /data/wwwlogs/satis.log combined;#root /data/wwwroot/default;root /data/wwwroot/satis/web;index index.html index.htm index.php;#error_page 404 /404.html;#error_page 502 /502.html;location /nginx_status {stub_status on;access_log off;allow 127.0.0.1;deny all;}location ~ [^/]\.php(/|$) {#fastcgi_pass remote_php_ip:9000;fastcgi_pass unix:/dev/shm/php-cgi.sock;fastcgi_index index.php;include fastcgi.conf;}location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {expires 30d;access_log off;}location ~ .*\.(js|css)?$ {expires 7d;access_log off;}location ~ /\.ht {deny all;}}

5、配置成功 打开一下 packagist.xxx.top 网址就会看到如下的页面

6、下载我们的新包 修改composer.json 文件

{"repositories": [{"type": "composer","url": "http://packagist.xxx.top"}],"require":{"xiaoliu/test":"3.0","nothing/helper":"1.0.2"}
}
$ composer update
// 成功即可 已经冲我们自己的服务器下载了这些包 使用即可

如果报错
Your configuration does not allow connections to http://packagist.xxx.top/packages.json. See https://getcomposer.org/doc/06-config.md#secure-http for details
则在服务器上执行
composer config -g secure-http false

意义是默认禁用https请求,就可以了

7、优化 satis.json 从我们自己的服务器上下载包

{"name": "Nothing","homepage": "http://packagist.xxx.top","repositories": [{ "type": "vcs", "url": "https://gitee.com/liulonghai/test.git","type": "vcs", "url": "https://gitee.com/liulonghai/Helper.git"}],"require": {"xiaoliu/test": "*","nothing/helper": "*"},"archive": {"directory": "dist","format": "tar","prefix-url": "http://packagist.xxx.top","skip-dev": true}
}
    你会发现我们之前的配置 update 会比较慢 那是因为我们下载资源的时候都是从托管平台下下载的,添加这个则表示update 将从我们自己的服务器上下载,速度会快许多archive 存档在自己的服务器上-- directory 代码包存放的文件夹-- format 压缩的格式 默认是zip 我选择的是tar-- prefix-url 可选的。下载的地址 不填默认是 homepage 【satis.json】 的值-- skip-dev 默认是false 是否跳过开发分支

7、到这里就完成了。注意 每次更新了新的包 要来到satis 执行 php bin/satis build satis.json web


借鉴 : http://docs.phpcomposer.com/articles/handling-private-packages-with-satis.html

使用satis 搭建 自己composer 代码库 教程02相关推荐

  1. 基于satis搭建私有composer仓库

    what`s satis Satis 是一个静态的 composer 代码库生成器. 安装satis cd /www/ composer create-project composer/satis - ...

  2. 使用satis 搭建私有Composer

    前言 网上有很多教程,但是作为小白,遇见很多错误浪费了很多时间. 这里记录下我自己安装的整个流程 准备工作 安装composer 参考 http://docs.phpcomposer.com/00-i ...

  3. PHP使用satis搭建私有Composer仓库

    搭建私有composer   适用于公司内部进行包管理,在组件化.服务化场景下部分业务代码不方便放到开源平台,可使用内部git服务器,配合composer/satis项目搭建私有composer处理内 ...

  4. Composer Satis搭建

    采坑记录中 描述 Satis 是一个静态的 composer 代码库生成器 安装satis composer.phar create-project composer/satis --stabilit ...

  5. Satis搭建composer私有库(自定义下载目录)

    在我们的日常php开发中需要使用大量的第三方包和类库, 怎么管理是一个问题, 我们用的Yii2框架, 但是并没有把composer用起来, 由于最近更换为docker部署项目, 于是想起来用compo ...

  6. satis 搭建 Composer 私有库的方法

    安装 satis 命令行下执行: php create-project composer/satis --stability=dev --keep-vcs . 配置 创建 satis.json 文件, ...

  7. 使用 satis 搭建一个私有的 Composer 包仓库 在我们的日常php开发中可能需要使用大量的composer包,大部份都可以直接使用,但在公司内部总有一小部份包是不能公开的,这时候我们就需

    使用 satis 搭建一个私有的 Composer 包仓库 在我们的日常php开发中可能需要使用大量的composer包,大部份都可以直接使用,但在公司内部总有一小部份包是不能公开的,这时候我们就需要 ...

  8. GitHub基础教程(3) —— 如何删除代码库

    GitHub基础教程(3) -- 如何删除代码库 如果你想删除某个代码库,首先进入该库,点击右上方Settings 进入设置滑到最下方,点击Delete this repository 接下来你需要输 ...

  9. 使用 satis 搭建一个私有的 Composer 包仓库

    使用 satis 搭建一个私有的 Composer 包仓库 在我们的日常php开发中可能需要使用大量的composer包,大部份都可以直接使用,但在公司内部总有一小部份包是不能公开的,这时候我们就需要 ...

最新文章

  1. IE6、IE7、IE8的CSS、JS兼容
  2. 数据库异常 :java.sql.SQLException: Access denied for user ‘root‘@‘localhost‘ (using password: YES)
  3. 《众妙之门——网页排版设计制胜秘诀》——3.4 展现品牌视觉的同时保持网页的可读性...
  4. MaxCompute技术人背后的故事:从ApacheORC到AliORC
  5. Galaxy Note 20新爆料:至少有两款机型,处理器高低配
  6. kafka原理概念提炼
  7. 牛客网暑期ACM多校训练营(第二场):J. farm(暴力)
  8. 温故之.NET 任务并行
  9. 手动抛出异常_超实用:关于Java异常设计和处理
  10. 单片机仿真软件Proteus Pro 8.9版本License过期
  11. 什么是pid控制算法_控制算法原理及实现之PID(以飞控为例)
  12. 饥荒服务器物品指令,饥荒控制台指令大全物品大全服务器管理命令大全.docx
  13. FreeSWITCH对接MRCP Server
  14. No suitable resolver
  15. COM08 -如何基于Davinci工具配置CAN通信协议栈实战课程【配置方法总述】
  16. Android-S SystemServer
  17. CPU基本结构和运行原理
  18. Java集合篇:Map集合的几种遍历方式及性能测试
  19. nRF2401A/nRF24L01/nRF24L01+无线模块最常见问题汇集(转)
  20. Camtasia Studio8如何提高视频画质和清晰度

热门文章

  1. 通过硬盘盘符查询硬盘槽位
  2. 字节(计算机单位)-1024
  3. 钢铁出口再度收紧 资质标准年底出台
  4. 大数据与人工智能都分不清楚,还想走向人生巅峰?
  5. 二三里APP逆向- 国庆篇
  6. bzoj1012(B站AC第六题)
  7. 全国行政区划代码具体到县
  8. 梯形图中常闭常开触点的选择
  9. 华三交换机配置多个镜像口_H3C交换机配置多个流量镜像观察口
  10. crontab每小时执行