英文:
How do Symfony Flex recipes know what packages to install?
问题
我正在尝试理解Symfony食谱如何知道要在途中安装哪些包。
阅读源代码,我觉得当我运行
composer require twig
Composer,作为一个插件,执行以下步骤:
- 查找名为 twig 的别名
- 发现它注册了 symfony/twig-pack 食谱
- 下载食谱并读取其 manifest.json
- 执行 manifest.json 中定义的所有操作,如创建额外的文件或附加内容到文件中
但我在 manifest.json 中没有看到安装 实际包 symfony/twig-pack 的地方。
这是否暗示着 所有 食谱必须与它们安装的包共享名称,这是Composer知道要安装哪个包的方式?
也就是说,开发人员不能只创建一个食谱 invented_company/nonexisting_package,只是在这里添加一些文件并在那里附加一些行,但实际上与Packagist上的包不对应?
英文:
I am trying to understand how Symfony recipes know what packages to install along the way.
Reading the source code, it seems to me that when I run
composer require twig
the composer, having flex as a plugin,
- looks for an alias called twig
- sees that it is registered for the recipe symfony/twig-pack
- downloads the recipe and reads its manifest.json
- executes all the actions defined in manifest.json, like creating extra files or appending stuff to files
But nowhere do I see in the manifest.json to install the actual package symfony/twig-pack.
Is it just implicit that all recipes have to share their name with the package they are installing and that this is the way how composer knows what package to install?
I.e. a developer can not just create a recipe invented_company/nonexisting_package that just adds a few files here and appends a few lines there, but not actually corresponds to a package on packagist?
答案1
得分: 1
有一个有关创建食谱的描述。
它说:
食谱必须存储在它们自己的存储库中,不得存储在您的Composer包存储库之内。它们必须遵循vendor/package/version/目录结构,其中version是食谱支持的最低版本。
https://github.com/symfony/recipes/blob/master/README.rst
英文:
There is a description of the creation of recipes.
It says
> Recipes must be stored on their own repositories, outside of your Composer package repository. They must follow the vendor/package/version/ directory structure, where version is the minimum version supported by the recipe.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论