如何用我自己的VCS存储库覆盖作曲家中的sylius 0.18?

时间:2016-09-20 21:13:45

标签: git github composer-php sylius

我必须保留0.18的sylius / sylius

我分叉了主人并创建了一个新的分支0.18,在一些PR中合并。

现在我想使用这个存储库而不是sylius / sylius v0.18标记

这里是我的composer.json

{
"name":        "sylius/sylius-standard",
"description": "Starting point for projects powered by Sylius eCommerce.",
"keywords":    ["symfony", "symfony2", "sylius", "distribution", "ecommerce", "cart", "shopping"],
"type":        "project",
"license":     "MIT",
"homepage":    "http://sylius.org",
"authors": [
    {
        "name":     "Paweł Jędrzejewski",
        "homepage": "http://pjedrzejewski.com"
    },
    {
        "name":     "Sylius project",
        "homepage": "http://sylius.org"
    },
    {
        "name":     "Community contributions",
        "homepage": "http://github.com/Sylius/Sylius/contributors"
    }
],
"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/ibasaw/DoctrineBehaviors"
    },
    {
        "type": "vcs",
        "url": "https://github.com/ibasaw/sylius"
    }
],
"require": {
    "php": ">=5.6",

    "sylius/sylius": "^0.18@dev",
    ......
},
"require-dev": {
    "behat/behat": "^3.0",
    "behat/symfony2-extension": "^2.0",
    "behat/mink-extension": "^2.0",
    "behat/mink-browserkit-driver": "^1.2",
    "behat/mink-selenium2-driver": "^1.2",
    "behat/mink":  "^1.6",
    "coduo/php-matcher": "^2.1@dev",
    "phpspec/phpspec": "^2.4",
    "phpunit/phpunit": "^4.1",
    "lakion/api-test-case": "^1.0@dev"
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
    "post-install-cmd": [
        "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Symfony\\Cmf\\Bundle\\CreateBundle\\Composer\\ScriptHandler::downloadCreateAndCkeditor",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
    ],
    "post-update-cmd": [
        "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Symfony\\Cmf\\Bundle\\CreateBundle\\Composer\\ScriptHandler::downloadCreateAndCkeditor",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
    ]
},
"autoload": {
    "psr-0": {
        "": "src/",
        "Context": "features/"
    }
},
"config": {
    "bin-dir": "bin"
},
"extra": {
    "branch-alias": {
        "dev-master": "0.18"
    },
    "symfony-app-dir": "app",
    "symfony-web-dir": "web",
    "incenteev-parameters": {
        "file": "app/config/parameters.yml"
    }
}

}

当我做作曲家更新时,在供应商目录中它需要sylius / sylius而不是ibasaw / sylius

为什么?

如何强制将VCS与我的新分支0.18一起使用?

2 个答案:

答案 0 :(得分:0)

  1. 给你的fork一个自己的包名(composer.json中的name字段)
  2. 使用https://getcomposer.org/doc/04-schema.md#replace替换声明您的包替换原始包
  3. 在根composer.json
  4. 中要求您的

答案 1 :(得分:0)

在composer.json

中添加这样的分叉Sylius存储库
"repositories": [
{
  "type": "git",
  "url": "https://github.com/ylastapis/Sylius.git"
}],

您可以要求您的主分支机构或创建自定义分支(合并您的代码,等待Sylius团队接受您的合并,我的称为master-poc)

在require部分中,要求您的分支,以" dev - "为前缀。所以master变成了dev-master,因此我的分支master-poc现在是dev-master-poc

"require": {
    "sylius/sylius": "dev-master-poc"
  },

我也有一个分支别名,不记得它是否还有用

  "extra": {
    "branch-alias": {
      "dev-master": "1.0-dev"
    }
  }

指向文档的一些链接:https://getcomposer.org/doc/05-repositories.md#loading-a-package-from-a-vcs-repository