如何创建可以通过composer create-project创建框架文件的composer包

I am thinking to create a project skeleton in the following format via a composer package that I am going to create.

  • /app
  • /config
  • /web
  • /vendors

Just wondering about this command

composer create-project vendor/name path --repository-url=http://repo.yourcomposerrepo.com

What do I need to put in the composer.json in order to create the file structure I want? Is it done through the shell script or it just copied the files from the repositories?

For symfony it will create the files and folders automatically through composer create-project. Just wondering how do I achieve the similar thing for this case. When I looked at their repo it only contains one composer.json at https://github.com/symfony/skeleton

composer create-project symfony/skeleton blog

Thank you.

composer create-project will create a new directory with all the files that are part of that package and then it will run the installation for all the dependencies that are listed in that package's composer.json file.

If you want to have a better example to understand that, you can use the old way that we used to bootstrap Symfony applications (when not using the Symfony installer). Then applications were based on the Symfony Standard Edition which you can find on GitHub. Just run composer create-project symfony/framework-standard-edition and compare the result with the repository.

Using symfony/skeleton as the base package is a bit special. This package depends on Symfony Flex which is a Composer plugin that automatically applies so called recipes (see https://flex.symfony.com/) which will lead to newly created files when a package is installed (and clean them up on removal). But, this behaviour is special for Flex and thus nowadays Symfony 4 based application and not a good example for what composer create-project does by default.