无法使用composer启动我自己的包

我正在使用symfony4,我想创建并使用我自己的包。 </ p>

我按照教程创建了自己的软件包: https:/ /symfonycasts.com/screencast/symfony-bundle </ p>

我在第09章:正确的bundle composer.json文件</ strong>中遇到问题。 </ p>

我已按照本章的所有步骤操作。 我已经尝试按照指示启动命令 composer require bon-coin-bundle:* @ dev </ code>,但这是我的错误:</ p>


  • “bon-coin-bundle”不是有效的别名。 你的意思是:

    “symfony / monolog-bundle”,支持别名:“monolog-bundle”</ li>
    </ ul>

    因此我尝试启动其他命令 没有更好的结果: composer require ../ bon-coin-bundle:* </ code>, composer require ../ bon-coin-bundle:* @ dev </ code> ... </ p>

    我已经像这样编辑了composer.json:</ p>

      {
    “name”:“bon-coin-bundle”,\ n“description”:“Bon Coin”,
    “type”:“symfony-bundle”,
    “license”:“MIT”,
    “”authors“:[
    {
    ”name“:”matodo “,
    ”电子邮件“:”matodo@xxx.com
    }

    ],
    ”要求“:{
    ”php“:”^ 7.1.3“
    },
    ”autoload“ :{
    “psr-4”:{
    “bonCoinBundle \”:“bonCoinBundle”
    }
    }
    }
    </ code> </ pre>

    (I 我不确定我为自动加载部分做了什么,但我不认为问题出现在那里)</ p>

    我的文件夹排名如下:一个bonCoinBundle文件夹包含 DependencyInjections,资源和服务 ces for my bundle。

    文件夹bonCoinBundle不在我当前的projet symfony中。 </ p>

      bonCoinBundle 
    | - DependencyInjection
    Resources
    ...
    symfonyProject
    | - src
    ...
    </ code> </ pre>

    </ div>

展开原文

原文

I am working with symfony4 and I want to create and use my own bundle.

I have created my own bundle following the tutorial: https://symfonycasts.com/screencast/symfony-bundle

I am encoutering a problem at the Chapter 09: Proper Bundle composer.json File.

I have followed all steps of this chapter. I've tried to launch the command composer require bon-coin-bundle:*@dev as indicated, but here are my errors:

  • "bon-coin-bundle" is not a valid alias. Did you mean this:
    "symfony/monolog-bundle", supported aliases: "monolog-bundle"

Thus I tried to launch other commands without better results: composer require ../bon-coin-bundle:*, composer require ../bon-coin-bundle:*@dev ...

I've edited the composer.json like this:

{
    "name": "bon-coin-bundle",
    "description": "Bon Coin",
    "type": "symfony-bundle",
    "license": "MIT",
    "authors": [
        {
            "name": "matodo",
            "email": "matodo@xxx.com"
        }
    ],
    "require": {
        "php": "^7.1.3"
    },
    "autoload": {
        "psr-4": {
            "bonCoinBundle\\": "bonCoinBundle"
        }
    }
}

(I am not really sure of what I've done for the autoload part, but I don't think that the problem comes frome there)

My folders are ranked like this: a bonCoinBundle folder contains DependencyInjections, Resources and services for my bundle. The folder bonCoinBundle is not in my current projet symfony.

bonCoinBundle
|- DependencyInjection
   Resources
   ...
symfonyProject
|- src 
   ...

du8791069
du8791069 您是否将捆绑包发布到packagist或在项目的composer.json中设置了bundle的存储库?
大约一年之前 回复

1个回答



我不知道将包发布到packagist是什么意思,但我把这条路径放在了project的composer.json中:</ p>

 “repositories”:[
{
“type”:“path”,
“url”:“.. / bonCoinBundle”
}
]

</ code> </ pre>
</ div>

展开原文

原文

I don't know what means posting a bundle to packagist, but I've put this path in project's composer.json :

"repositories": [
        {
            "type": "path",
            "url": "../bonCoinBundle"
        }
    ]

duanquannan0593
duanquannan0593 我发现了我的错误,我不是在开发! 我在两个作曲家中添加了“最小稳定性”:“dev”,它修正了我的错误
大约一年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问