如何使用私库

  • 把私服地址packagist.wiiqq.com加到repositories
{
    "type": "composer",
    "url": "https://packagist.wiiqq.com/"
},
{
    "packagist": false
}
  • 自研开发的库以vcs的方式添加到repositories
{
    "type": "vcs",
    "url": "https://code.wiiqq.com/git/wii/wii2-cb.git"
}
  • config里的fxp-asset不需要加载其它插件
"config": {
    "process-timeout": 1800,
    "fxp-asset": {
        "enabled": false
    }
},

完整的composer.json示例:

{
  "name": "wii/wii-cb",
  "description": "The Imagine integration for the wii/wii2-app",
  "version": "1.0.0",
  "type": "project",
  "keywords": [
    "wii2",
    "application"
  ],
  "authors": [
    {
      "name": "yeedomliu",
      "email": "yeedomliu@tencent.com",
      "homepage": "http://www.qq.com",
      "role": "developer"
    }
  ],
  "repositories": [
    {
      "type": "vcs",
      "url": "https://code.wiiqq.com/git/wii/wii2-cb.git"
    },
    {
      "type": "composer",
      "url": "https://packagist.wiiqq.com/"
    },
    {
      "packagist": false
    }
  ],
  "minimum-stability": "dev",
  "prefer-stable": true,
  "require": {
    "wii/wii2": "dev-2.3.0-dev",
    "wii/wii2-wau": "2.1.0.x-dev",
    "wl/wl-lib": "dev-1.0.0-dev",
    "wii/wii2-cb": "dev-1.0.0-dev",
    "wii/wii2-plugin": "dev-1.0.0-dev"
  },
  "require-dev": {
    "yiisoft/yii2-debug": "~2.0.13",
    "yiisoft/yii2-gii": "~2.0.7",
    "yiisoft/yii2-faker": "~2.0.4",
    "yiisoft/yii2-apidoc": "~2.1.0",
    "codeception/codeception": "~2.4.2",
    "codeception/specify": "~1.1",
    "codeception/verify": "~1.0.0"
  },
  "config": {
    "process-timeout": 1800,
    "fxp-asset": {
      "enabled": false
    }
  },
  "scripts": {
    "post-create-project-cmd": [
      "wii\\composer\\Installer::postCreateProject"
    ],
    "post-install-cmd": [
      "mkdir -p runtime; mkdir -p web/assets; chmod -R 777 runtime web/assets"
    ]
  }
}
  • 使用composer命令安装

composer install -vvv --profile --prefer-dist

可以看到,整个安装过程耗时很短,这里使用了--prefer-dist选项(优先下载压缩包)可以提高速度,默认是从git仓库clone代码(相对慢一些)

results matching ""

    No results matching ""