【问题标题】:Symfony2 - Add another custom Symfony2 project as a vendorSymfony2 - 添加另一个自定义 Symfony2 项目作为供应商
【发布时间】:2014-11-19 16:05:39
【问题描述】:

我有两个 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中导入bundle

    new SciForum\JournalsReview\SciForumJournalsReviewBundle(),
    

当你尝试这样做时

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.

有什么想法吗?谢谢。

【问题讨论】:

  • 好像有错别字,“journals_revie_bundle”而不是“journals_review_bundle”...
  • 对不起,错字在问题中,在代码中没问题,我会编辑问题

标签: php symfony bundle composer-php vendor


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2016-09-05
    • 2013-08-28
    • 2015-03-26
    • 1970-01-01
    • 2014-02-26
    • 1970-01-01
    • 2012-09-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多