0

I'm using Windows and I installed composer from its Windows installer. What I want to do is to install DoctrineMigrationsBundle to my project, so I added

"doctrine/doctrine-migrations-bundle": "dev-master"

to the composer.json file in the project and run

cd the project directory
php composer.phar update

but what I get is: Could not open input file: composer.phar

My whole composer.json file is

{
    "name": "symfony/framework-standard-edition",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-0": { "": "src/" }
    },
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.1.*",
        "doctrine/orm": ">=2.2.3,<2.4-dev",
        "doctrine/doctrine-bundle": "1.1.*",
        "twig/extensions": "1.0.*@dev",
        "symfony/assetic-bundle": "2.1.*",
        "symfony/swiftmailer-bundle": "2.1.*",
        "symfony/monolog-bundle": "2.1.*",
        "sensio/distribution-bundle": "2.1.*",
        "sensio/framework-extra-bundle": "2.1.*",
        "sensio/generator-bundle": "2.1.*",
        "jms/security-extra-bundle": "1.2.*",
        "jms/di-extra-bundle": "1.1.*",
        "kriswallsmith/assetic": "1.1.*@dev"
        "doctrine/doctrine-migrations-bundle": "dev-master"
    },
    "scripts": {
        "post-install-cmd": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ],
        "post-update-cmd": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ]
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web"
    }
}

Can you please help me to fix this?

j0k
  • 22,600
  • 28
  • 79
  • 90
Faery
  • 4,552
  • 10
  • 50
  • 92

5 Answers5

6

As said by @AhmedSiouani, the error tells you that they can't find a composer.phar file.

Some things you can do:

  1. Download the Composer-SetUp.exe and install Composer as told on the downloads page (scroll to 'Windows Installer');
  2. Download the composer.phar file and put that in your project (not recommend);
  3. Download the composer.phar file and put that in a directory which is in your PATH environment variable1;
  4. Download the composer.phar file and create a composer.bat file which executes the composer.phar file. Put the code below in it and save it in a directory which is in your PATH environment variable1.

    @echo off
    php "path\to\composer.phar" %*
    

1: You can see which directories are in the PATH environment variable by running echo %PATH% in your cmd.
You can also put the directory where this file lives in the PATH environment. To do that, go to Computer (right click) > Settings > Advanced Settings > Environments Variables (under the 'advanced' tab) and set the PATH variable with your directory path (or add the path to the current PATH variable, by putting a ; between the paths).

Wouter J
  • 41,455
  • 15
  • 107
  • 112
2

The error message is clear enough, it's not related to your composer.json file.

I think you just need to move your composer.phar file to your project directory.

Also, a much reusable solution would be to call it through your PATH environment variable.

Ahmed Siouani
  • 13,701
  • 12
  • 61
  • 72
1

Got the same issue with me "Could not open input file: composer.phar"

Fix : Go to the project directory and run following command

php -r "readfile('https://getcomposer.org/installer');" | php

and run

php composer.phar install or php composer.phar update

This will work awesome.

Bishwanath Jha
  • 399
  • 3
  • 10
0

I working on fedora 17 I ran it on console to download composer.phar :

$ curl -s https://getcomposer.org/installer | php

then it's work now.

Hugo Dozois
  • 8,147
  • 12
  • 54
  • 58
Yoesoff
  • 368
  • 5
  • 11
0

Make sure your code:

 "kriswallsmith/assetic": "1.1.*@dev"
 "doctrine/doctrine-migrations-bundle": "dev-master"

is changed to:

"kriswallsmith/assetic": "1.1.*@dev",
 "doctrine/doctrine-migrations-bundle": "dev-master"

notice adding a , (comma).

rene
  • 41,474
  • 78
  • 114
  • 152