-1

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,

  1. looks for an alias called twig
  2. sees that it is registered for the recipe symfony/twig-pack
  3. downloads the recipe and reads its manifest.json
  4. 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?

fridde
  • 472
  • 1
  • 5
  • 17

1 Answers1

1

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.

https://github.com/symfony/recipes/blob/master/README.rst

Aleksandr
  • 401
  • 3
  • 7
  • I had been reading exactly that documentation, but I interpreted the part you are mentioning being about naming, not about a 1-to-1 relationship between package and recipe. It would have been nice to include a "Flex will automatically install the package with the same name for you AND perform your recipe". But maybe that was clear from the beginning. Thanks for taking the time! – fridde Jan 06 '20 at 13:04