douchi1945 2019-06-25 12:49
浏览 223

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

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 
   ...
  • 写回答

1条回答

  • douzuo0711 2019-06-25 12:59
    关注

    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"
            }
        ]
    
    
    评论

报告相同问题?

悬赏问题

  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 有没有帮写代码做实验仿真的
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥30 vmware exsi重置后登不上
  • ¥15 易盾点选的cb参数怎么解啊
  • ¥15 MATLAB运行显示错误,如何解决?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题