How to install dependencies or use composer in general in windows

I installed the composer through the Windows installer and set the correct path variables for php for wamp php, now I created the composer.json file (and later .phar)

and try to install the dependencies listed there

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

this comes from almost every team including

 php composer.phar install php composer.json install 

I did this in windows cmd, so I'm not sure if this is affecting anything.

+6
source share
3 answers

Edit: A Windows installer is installed on the Composer download site, which will install Composer worldwide, so you won’t need composer.phar anymore. Install it from here , and then simply run the “installation linker” from the directory in which you have composer.json .

(original answer below)

I myself have not experienced this, but I think it should work:

Download composer.phar and put it in the same directory as your composer.json .

cd to the directory in which you have composer.json :

cd some \ directory

Finally, run the composer:

php composer.phar install

+7
source

For novice Windows users

  • Download the installer for Windows from here

  • Verify the installation by running the composer command at a command prompt

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

  • Change to the directory with composer.json with the command line and run the following command:

     composer install 
  • It will display messages such as "packages loaded" and "autoload.php created file". (Check the directory /app/Vendor/ )

  • Now paste this code at the beginning of /app/config/core.php :

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

The above code will automatically load all classes.

Hope this helps beginners.

+11
source

I have this problem for a long time, but with a simple error. Good First you need to enable extension=php_openssl.dll on your php.ini and if it does not exist, include or add the second step to the end of the file, go to this directory:

 C:\Users\{YOUR USERNAME}\AppData\Roaming\Composer 

And paste your composer.json here, make a folder and name it "vendor", then enable or run your PHP server and run cmd as administrator and enter this

 composer install 

Enjoy it

0
source

Source: https://habr.com/ru/post/958543/


All Articles