每次创建一个新的Laravel项目时,Composer都会重新安装所有内容 - 为什么?

问题描述:

I'm messing about with Laravel 4, which looks great.

However, every time I create a new project I have to wait 10 minutes while Composer downloads all the dependencies. Surely they needn't be downloaded more than once?

05:36:49 ~/projects$ composer create-project laravel/laravel myproject
Installing laravel/laravel (v4.0.5)
  - Installing laravel/laravel (v4.0.5)
    Loading from cache

Created project in myproject
Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Installing doctrine/lexer (dev-master bc0e1f0)
    Cloning bc0e1f0cc285127a38c6c8ea88bc5dba2fd53e94

[.. installs for 10 minutes ... ]

Any way around this?

我正在搞乱Laravel 4,看起来很棒。 p>

但是,每次创建新项目时,我都要等待10分钟,而Composer会下载所有依赖项。 当然他们不需要多次下载? p>

  05:36:49~ / projects $ composer create-project laravel / laravel myproject 
安装laravel / laravel(v4。  0.5)
  - 安装laravel / laravel(v4.0.5)
从myproject中加载缓存
 
Created项目
使用包信息加载编写器存储库
安装依赖项(包括require-dev)
  - 安装doctrine / lexer(  dev-master bc0e1f0)
克隆bc0e1f0cc285127a38c6c8ea88bc5dba2fd53e94 
 
 [..安装10分钟...] 
  code>  pre> 
 
 

有什么方法吗? p> div>

Try adding the --prefer-dist switch to the command line. That should force Composer to download ready-made ZIPs with the required versions.

But do note that you have a dependency on "dev-master" for doctrine/lexer - these will usually only be resolved by cloning the GIT repository instead of always downloading the latest tip of that branch. Try to require a known version tag or version wildcard instead.