Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to install dependencies or use composer at all in windows

I've installed composer via windows installer, and set the correct path variables for php to wamp's php, now I created a composer.json( and later .phar) file

and attempt to install dependencies listed there

{
"name": "phpunit/php-unit",
"require": {
    "php": ">5.4.12",
    "phpunit/phpunit": "3.7.28"
}
}

this comes out of almost every command, including

php composer.phar install
php composer.json install

i did ran this in windows cmd so im not sure if that affects anything.

like image 464
user2167582 Avatar asked Nov 21 '13 08:11

user2167582


1 Answers

For very Beginner Windows Users

  1. Download the installer for windows from here

  2. Check the installation by executing composer command at command prompt

  3. Now, create the composer.json file at the same level where you have Vendor directory (not inside Vendor).

  4. Move to the directory where you have composer.json with the command prompt and run the following command:

    composer install
    
  5. It will show messages like 'packages are downloaded' and 'autoload.php file created'. (Check your /app/Vendor/ directory)

  6. Now insert this code at the beginning of /app/config/core.php:

    require_once dirname(__DIR__) . '/Vendor/autoload.php';
    

The code above will load all the classes automatically.

Hope this helps for beginners.

like image 155
Girish Thimmegowda Avatar answered Sep 17 '22 16:09

Girish Thimmegowda