php - 无法使用作曲家启动我自己的捆绑包
问题描述
我正在使用 symfony4,我想创建和使用我自己的包。
我按照教程创建了自己的包:https ://symfonycasts.com/screencast/symfony-bundle
我在第 09 章遇到了一个问题:正确的捆绑 composer.json 文件。
我已遵循本章的所有步骤。我已尝试composer require bon-coin-bundle:*@dev
按照指示启动命令,但这是我的错误:
- “bon-coin-bundle”不是有效的别名。您的意思是:
“symfony/monolog-bundle”,支持的别名:“monolog-bundle”
因此,我尝试在没有更好结果的情况下启动其他命令:composer require ../bon-coin-bundle:*
, composer require ../bon-coin-bundle:*@dev
...
我已经像这样编辑了 composer.json:
{
"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"
}
}
}
(我不太确定我为自动加载部分做了什么,但我不认为问题来自那里)
我的文件夹排列如下:一个 bonCoinBundle 文件夹包含我的捆绑包的 DependencyInjections、资源和服务。文件夹 bonCoinBundle 不在我当前的项目 symfony 中。
bonCoinBundle
|- DependencyInjection
Resources
...
symfonyProject
|- src
...
解决方案
我不知道将捆绑包发布到 packagist 意味着什么,但我已将此路径放在项目的 composer.json 中:
"repositories": [
{
"type": "path",
"url": "../bonCoinBundle"
}
]
推荐阅读
- sql - sql查询将单元格值设置为另一列中另一个单元格之间的差减去先前结果
- javascript - 更改特定值的颜色
- python - 两个字典,其中一些元素链接/连接和一些独特的
- python - Keras NASNet 训练
- java - 获取 kubernetes secret / env 以在 java 应用程序中进行身份验证
- python - Displaying JSON data in a 'Zotero'-like fashion, using Tkinter
- routing - Angular 7延迟加载,子路由总是加载第一条路由
- macos - Meteor CLI 无法进行全新安装
- python - 连接字典中元组的三元组
- android - 后台服务中的 Google Vision API?