在AppKernel中找不到symfony 2.7基本包类

时间:2016-11-17 14:18:30

标签: composer-php symfony-2.7

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

创建了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中注册捆绑包

  

new Extremesolution \ Bundle \ PaymentHandlerVodafoneBundle \ ExtremesolutionPaymentHandlerVodafoneBundle()

然而每当我运行作曲家更新时,我都会

  

[RuntimeException的]
    执行"'缓存时发生错误:clear --no-warmup'"命令:
    致命错误:Class' Extremesolution \ Bundle \ PaymentHandlerVodafoneBundle \ ExtremesolutionPaymentHandlerVodafoneBundle'找不到/ home / kan / symfony_
    第25行的试验/ payment-example / app / AppKernel.php
    PHP致命错误:Class' Extremesolution \ Bundle \ PaymentHandlerVodafoneBundle \ ExtremesolutionPaymentHandlerVodafoneBundle'找不到/ home / kan / sym
    第25行的fony_trials / payment-example / app / AppKernel.php
    。

我使用php版本5.5.38通过phpbrew,作曲家版本1.2.1和symfony 2.7

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

2 个答案:

答案 0 :(得分:0)

您的问题可能来自您的软件包位于私有存储库的事实。 我建议你将可见性改为公开,并将其发布在packagist上。

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

希望它可以提供帮助,

问候

答案 1 :(得分:0)

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

相关问题