我应该为每个项目下载Laravel吗?

Maj*_*Afy 5 php git laravel laravel-4

我用Laravel创建了一个项目,并git通过以下命令下载:

git clone -b develop git://github.com/laravel/laravel.git
Run Code Online (Sandbox Code Playgroud)

文件大小约为21MB,

我想知道我是否应该使用此命令为每个项目下载Laravel?

Len*_*eng 6

你所做的就是克隆框架本身,你应该只在你要分叉和开发Laravel核心时才这样做.

你应该做的是使用Composer来安装你的Laravel项目.您还将在所述项目中使用Composer进行其他与依赖项相关的操作(包括自动加载).这是安装新的Laravel框架以开发网站的正确方法:

composer create-project laravel/laravel --prefer-dist
Run Code Online (Sandbox Code Playgroud)

http://laravel.com/docs/installation

然后,您创建的任何未来Laravel项目都将从Composer缓存加载而无需重新下载.

Composer软件包还可以设置所有与供应商相关的.gitignore信息,并包含其他几个非常有用的管理功能.这很重要,因为您只希望将特定于应用程序的代码保留在git版本控制之下,而不是框架本身或任何其他依赖项.(否则,您的差异和提交将受到依赖项开发更改的污染.)

一旦你创建你的项目库,并与作曲家安装Laravel,并创建了第几次提交(对于某些迁移,模型和控制器,例如),克隆你的项目通常工作是这样的:

cd /clone-here
git clone /myproject # Location of current project
# /clone-here now has only the application-specific files from /myproject.  It is 
# still missing the framework itself and other dependencies.
composer install  # Composer now looks at the dependencies in 
                  # /clone-here/composer.json and installs them into /clone-here/vendor
                  # including the Laravel framework.
# Now the framework and other dependencies are good to go.
php artisan migrate # Laravel makes all your DB schemas from your migrations
php artisan db:seed # Seed your lovely new DB tables
Run Code Online (Sandbox Code Playgroud)

一旦你习惯它,它真的很优雅和有趣.

编辑:Sheikh回答节省一些时间在作曲家的安装过程!


The*_*pha 5

已经Leng给出了一个很好的答案.

安装Laravel因为version-4.1*通过Laravel安装快于composer

首先,下载Laravel安装程序PHAR存档.为方便起见,将文件重命名为laravel并将其移至/ usr/local/bin.安装完成后,简单的laravel new命令将在您指定的目录中创建一个全新的Laravel安装.例如,laravel new blog将创建一个名为blog的目录,其中包含安装了所有依赖项的全新Laravel安装.这种安装方法比通过Composer安装快得多.