Symfony2 - 添加另一个自定义Symfony2项目作为供应商

时间:2014-11-19 16:05:39

标签: php symfony bundle composer-php vendor

我有两个symfony2项目A和B. 我的目标是将项目B作为供应商添加到项目A中。

我做了什么:

  1. 编辑A项目中的composer.lock文件,将项目B包含为供应商:

    "name": "sciforum/journals_revie_bundle",
        "version": "dev-master",
        "target-dir": "SciForum/JournalsReview",
        "source": {
            "type": "git",
            "url": "ssh://git@dev.mdpi.lab:22/~/projects/journals_review",
            "reference": "dc8ea6a551e5d42b972dd302b75d9ce0a26735f3"
        },
        "require": {
            "php": ">=5.3.3"
        },
        "type": "symfony-bundle",
        "extra": {
            "branch-alias": {
                "dev-master": "2.0-dev"
            }
        },
        "autoload": {
            "psr-0": {
                "SciForum\\JournalsReview\\": ""
            }
        },
        "description": "SciForumJournalsReview",
        "homepage": "http://www.sciforum.net",
        "time": "2014-11-14 11:11:33"
    },
    
  2. 更改了项目B中的composer.json

    {
    "name" : "sciforum/journals_review_bundle",
    "type" : "symfony-bundle",
    "description" : "SciForumJournalsReviewBundle",
    "homepage" : "http://www.sciforum.net",
    "require" : {
        "php" : ">=5.3.3"
    },
    "  autoload" : {
      "psr-0" : {
            "SciForum\\JournalsReviewBundle\\" : ""
        }
    },
    "target-dir" : "SciForum/JournalsReviewBundle",
    "extra" : {
        "branch-alias" : {
            "dev-master" : "2.0-dev"
        }
    }
    

    }

  3. 在项目A AppKernel.php中导入捆绑包

    new SciForum\JournalsReview\SciForumJournalsReviewBundle(),
    
  4. 尝试时

    sudo php composer.phar install
    

    我正在

    Your requirements could not be resolved to an installable set of packages.
    
    Problem 1
    - The requested package sciforum/journals_review_bundle could not be found in any version, there may be a typo in the package name.
    Problem 2
    - The requested package sciforum/journals_revie_bundle could not be found in any version, there may be a typo in the package name.
    
    Potential causes:
     - A typo in the package name
     - The package is not available in a stable-enough version according to your minimum-stability setting
     see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
    

    有什么想法吗?谢谢。

1 个答案:

答案 0 :(得分:0)

我没有使用自定义供应商,而是将我的自定义捆绑包作为辅助捆绑包包含在我的主项目中,并且一切运行良好。