douchi1945
2019-06-25 12:49 阅读 186

无法使用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 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"
            }
        ]
    
    
    点赞 评论 复制链接分享

相关推荐