Composer how to specify install directory

Hi I've recently downloaded Laravel as a PHP framework, I've installed composer and have got that working, I've got it to create my project as per the Laravel website

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

However when I use the above line this installs my project in the c:\users\guti directory however I want it to be installed in c:\xampp\htdocs.

I've seen another question on stackoverflow and it talks about amending the composer.json file but I'm not sure whether this is the route I should be taking as I've done a computer search for this file and this file exists as part of the laravel framework so does it make sense to amend this file?

Any composer experts on hand to point me in the right direction?


composer create-project laravel/laravel .

Installs in your current directory =)


You should specify your destination directory where you want to create the project, from the command prompt, type cd C:\xampp\htdocs then press enter. After that, type following code on the command prompt and press enter

composer create-project laravel/laravel my-laravel-project

Here my-laravel-project will be your project folder. The composer.json file is used to setup some configurations (for Dependency management) during installation of the package via packagist. Visit getcomposer.org for more information.


Whenever

composer create-project laravel/laravel .

Doesn't work properly for whatever reason, I just

 laravel new temp 

And then move the contents of the new application into the folder I do want ; )


I needed to do this myself. In the directory I wanted it installed, I did:

laravel new --force .

And it seems to be working well so far.


TL;DR

  1. composer create-project --prefer-dist laravel/laravel directory-name
  2. Move files to preferred folder if needed (e.g. to ../)

Why don't laravel new /.?

  1. laravel new project-name not always works good on different systems, so you need to edit PATH variable multiple times to add laravel command to cli (at least on OSX it's not that easy as on Ubuntu).
  2. composer create-project --prefer-dist . may not work because of not empty directory (e.g. in JetBrains IDE's, which creates folder .idea/ which doesn't shows in IDE's 'project' view, only on 'project files'). Exception message looks like

[InvalidArgumentException]
Project directory ./ is not empty.

So, if you know what you doing, do as you wish, on the other way, especially if you want as few problems as possible, do the steps from the top lines of this answer.

P.S. I'm speaking english not as good as i want to do, so, anyone, feel free to correct me.