Search code examples
installationcomposer-php

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?


Solution

  • 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.