donglang9880 2014-04-08 17:45
浏览 637
已采纳

在composer中,require和install与create-project之间的区别

I don't get how the create-project works in composer. Lets take Laravel as example.

I can install this PHP framework with the following command:

composer create-project laravel/laravel --prefer-dist

This command installs the framework for me leaving me with a few folder in the root of my dir:

  • app
  • bootstrap
  • public
  • vendor

Plus some files.

But when I simply use the following composer command:

composer require laravel/laravel --prefer-dist
composer install

Then this only installs the vendor folder. No other files and folders are downloaded by composer.

How come? What is so different? How does composer know what other files to get when I use the create-project laravel/laravel command and why do I only get the vendor folder when I do require laravel/laravel?

  • 写回答

1条回答 默认 最新

  • doudengjin8251 2014-04-08 17:50
    关注

    require will add a dependency to the composer.json file and load it into the vendor directory as you have correctly noticed.

    create-project on the other hand will clone the dependency, i.e. use the dependency as a template for a new project. Take a look at the repository behind laravel/laravel: https://github.com/laravel/laravel

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器