質問

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.

役に立ちましたか?

解決 2

Edit: actually there is a Windows installer on the Composer download page that will install Composer globally, so you won't need any composer.phar anymore. Install it from here, and then just run "composer install" from the directory where you have your composer.json.

(original answer below)

I didn't test this myself, but I think it's how it should work :

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

cd into the directory where you have your composer.json :

cd some\directory

Finally, run the composer :

php composer.phar install

他のヒント

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.

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

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

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

composer install

Enjoy It

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top