美文网首页
用 Satis 处理私有资源包(使用 satis 搭建 Comp

用 Satis 处理私有资源包(使用 satis 搭建 Comp

作者: _伽蓝寺听雨声 | 来源:发表于2018-01-19 10:23 被阅读70次

    参考:http://docs.phpcomposer.com/articles/handling-private-packages-with-satis.html

    目的:建立类 packagist.org 功能的私有仓库作为公司的代码库使用

    1.安装 satis

    composer create-project composer/satis --stability=dev --keep-vcs

    2.配置 config.json

    {

        "name": "蓝景丽家代码库",

        "homepage": "http://composer.develop",

        "repositories": [

            { "type": "git", "url": "ssh://test-git@192.168.9.224:2211/home/composer/excel" },

            { "type": "git", "url": "ssh://test-git@192.168.9.224:2211/home/composer/upload" }

        ],

        "require-all": true

    }

    3.构建web站点

    进入 satis 目录,使用如下命令构建 satis web站点:

    php bin/satis build config.json web

    注: composer的 repo.packagist 配置项如果采用的是国内的镜像地址,可能上面的 build 语句会失败,需要暂时去掉镜像配置,Linux 下可直接编辑 ~/.config/composer/config.json 文件去掉

    4.配置虚拟机

    配host composer.develop

    apache httpd-vhosts.conf 指定虚拟机的目录为 satis/web

    重启apache,访问 http://composer.develop 试试吧

    5.使用 satis 私有库

    本地配置下以下选项,指定私有composer库的地址,指定后就可以在 require 中使用私有 composer 项目了

    composer config -g secure-http false

    composer config -g repo.my_repo composer http://composer.develop

    当然也可以单独在composer.json文件中配置:

    {

        "repositories": [

          { "type": "composer", "url": "http://composer.develop/" }

        ],

        "require": [

            ...

        ],

        ...

    }

    相关文章

      网友评论

          本文标题:用 Satis 处理私有资源包(使用 satis 搭建 Comp

          本文链接:https://www.haomeiwen.com/subject/jtcooxtx.html