Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is main differences between composer create-project and git clone?

I would like to develop a web application based on Laravel framework without contributing to the framework at all. I like to periodically get update from the framework while developing my own web application. I also like to use version control system for myself and my team mate.

I'm not sure which strategy to use between

Using composer

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

And periodically keep update with Laravel using

composer update

Using git

git clone https://github.com/laravel/laravel.git webproject

And periodically keep update with Laravel using

git pull

What are the main differences between them?, one I know is that composer create-project --perfer-dist comes with cleaned version-control, what else?

If I used git clone at first, to get update from the framework using composer update would cause any harm?

like image 509
Artisan Avatar asked Oct 01 '13 10:10

Artisan


1 Answers

From what I understand is contained in that repository, it is merely an empty directory structure with some additional boilerplate code that would be needed identically when starting a new project. So in fact it is nice to not have to create all those directories and create all those configuration files when starting a new project.

But on the other hand you would not benefit in any case if that repository gets updated after you started your project. Any changes that will get committed there are targeted at helping new projects when they start, because something in the framework got updated and thus needs a change in the empty layout.

Additionally, when you clone a repo, you'd theoretically want to push back to it - which is not the case here, because the project you are about to start should not get added to this empty project.

So the right way to do it is to always use the composer command, and never clone the repository unless you want to add something in that exact repository as a contribution to the community.

Another remark: Calling composer update will grab the newest versions available and mentioned in composer.json, which you will extend. This includes also the newest release version of the Laravel framework, version "4.0.*". git pull instead will only update the empty layout, possibly destroying changes you already made (you'd have to resolve the conflict somehow), and you do not get the latest Laravel framework, because it isn't contained. You'd also have to call composer update.

So all in all, there is no benefit in cloning the repo. Just grab your own copy, put it in a repository for your own project, and use Composer to update any dependencies, including updates of the framework.

like image 180
Sven Avatar answered Sep 23 '22 07:09

Sven