【问题标题】:symfony 2.7 base bundle class not found in AppKernel在 AppKernel 中找不到 symfony 2.7 基包类
【发布时间】:2017-04-01 03:13:54
【问题描述】:

我已经通过 generator 命令创建了一个 symfony 2.7 包,它是在 src/Bundle/bundlename 下生成的,但是我想通过 composer 使用这个包以便能够在另一个项目中使用它,然后我移动了包文件为包创建了 composer.json

{
"name" : "extremesolution/payment-handler-vodafone-bundle",
"type" : "symfony-bundle",
"description": "Vodafone Redpoints Payment Handler Bundle",
"authors": [
    {
        "name": "Hazem Taha",
        "email": "hazem.taha@extremesolution.com"
    }
],
"require" : {
    "php": "^5.5"
},

"require-dev": {
    "phpunit/phpunit": "~3.7"
},

"autoload" : {
    "psr-4" : {
        "Extremesolution\\Bundle\\ExtremesolutionPaymentHandlerVodafoneBundle\\" : ""
    }
  }
}

并将其推送到 bitbucket 私有仓库,并在我的项目 composer.json 中需要捆绑包,并提供存储库 url 并在 AppKernel.php 中注册捆绑包

新的 Extremesolution\Bundle\PaymentHandlerVodafoneBundle\ExtremesolutionPaymentHandlerVodafoneBundle()

但是,每当我运行 composer update 时,我都会得到

[运行时异常]
执行“'cache:clear --no-warmup'”命令时出错:
致命错误:在 /home/kan/symfony_ 中找不到类“Extremesolution\Bundle\PaymentHandlerVodafoneBundle\ExtremesolutionPaymentHandlerVodafoneBundle”
第 25 行的试验/付款示例/app/AppKernel.php
PHP 致命错误:在 /home/kan/sym 中找不到类“Extremesolution\Bundle\PaymentHandlerVodafoneBundle\ExtremesolutionPaymentHandlerVodafoneBundle”
fony_trials/payment-example/app/AppKernel.php 第 25 行
.

我通过 phpbrew、composer 版本 1.2.1 和 symfony 2.7 使用 php 版本 5.5.38

我错过了什么吗?是否有要通过 composer 使用的捆绑包的自定义配置?

【问题讨论】:

    标签: composer-php symfony-2.7


    【解决方案1】:

    在您的 composer.json 文件中,您将 PSR-4 命名空间前缀配置为 Extremesolution\\Bundle\\ExtremesolutionPaymentHandlerVodafoneBundle\\。但是,根据错误消息,您正在尝试加载类Extremesolution\Bundle\PaymentHandlerVodafoneBundle\ExtremesolutionPaymentHandlerVodafoneBundle(注意缺少Extremesolution 部分)。

    【讨论】:

      【解决方案2】:

      您的问题可能来自您的包位于私有存储库中。 我建议您将可见性更改为 public 并将其发布在 packagist 上。

      如果由于某种原因您必须将其保密,请查看 how to handle private packages 上的作曲家文档。

      希望对你有帮助,

      问候

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-03-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-05-25
        • 1970-01-01
        相关资源
        最近更新 更多